public void CreateXML()
{
XDocument doc = new XDocument(new XDeclaration("1.0", "utf-16", "yes"),
new XElement("RootNode", new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"), new XAttribute(XNamespace.Xmlns + "xsd", "http://www.w3.org/2001/XMLSchema"), new XAttribute("Name", "X_SoftwareUpdate"), new XAttribute("LocaleId", "1033"),
new XElement("ChildNode",
new XElement("UpdateXMLDescriptionItem", new XAttribute("PropertyName", "_Product"), new XAttribute("UIPropertyName", ""),
new XElement("MatchRules",
new XElement("string", "''Product:X''")
))),
new XElement("ChildNode",
new XElement("UpdateXMLDescriptionItem", new XAttribute("PropertyName", "IsSuperseded"), new XAttribute("UIPropertyName", ""),
new XElement("MatchRules",
new XElement("string", "false")
))),
new XElement("ChildNode",
new XElement("UpdateXMLDescriptionItem", new XAttribute("PropertyName", "_UpdateClassification"), new XAttribute("UIPropertyName", ""),
new XElement("MatchRules",
new XElement("string", "''UpdateClassification:X''")
)))));
doc.Save(@"C:\test.xml");
}
source :
http://www.liberalcode.com/2014/04/your-one-stop-on-how-to-effectively.html[
^]