Reputation:
I want to make a xml file like:
<?xml version="1.0" encoding="Windows-1252" ?>
<settings>
<typeofsetting>
<wordname="add" />
</typeofsettings>
</settings>
The wordname
can be depend on what user need. How I can make a application that user can generate the XML file of thing they want. Are there any good way to do this?
The wordname
not user defined it's come from database the application have inbuilt.
Are their any good practice to do this in C# win-forms?
Upvotes: 3
Views: 107
Reputation: 29399
using System.Xml.Linq;
...
public void Foo()
{
var doc = new XDocument(
new XDeclaration("1.0", "Windows-1252", "yes"),
new XElement("settings",
new XElement("typeofsetting",
new XElement("word", new XAttribute("name", "add")))));
doc.Save("SomeFile.xml");
}
You can adapt this example to fit your needs.
Upvotes: 6
Reputation: 176936
yes
make use OF LINQ TO XML
one of the easy way to create xml
Upvotes: 4