|
Hi All,
I have an "Acount" and my Acount has multiple "users" .
And my user have three settings like App,Web,Key
So we have to write XML on this behalf of tree.
Structure like -
Acount
User1
Acount Setting
web
App
Key
User2
Acount Setting
web
App
Key
I have create XML like same as structure.
|
|
|
|
|
Have a look at the XmlDocument class here[^].
Basically you'd create a XmlDocument object and add XmlElement [^] instances.
For example:
XmlDocument document = new XmlDocument();
XmlElement root = document.CreateElement("Account");
root.SetAttribute("SomeAttribute", "42");
document.AppendChild(root);
XmlElement child = document.CreateElement("User1");
root.AppendChild(child);
XmlELement grandchild = document.CreateElement("AccountSetting");
child.AppendChild(grandchild);
document.Save(pathToMyXmlFile);
2A
|
|
|
|
|
Markovl's suggestion is good and I use it for small amounts of data. For large amounts of data I tend to use an XmlWriter -- I keep thinking of writing something about it.
|
|
|
|