Simple XML creation

To create the following XML document: 4000 Import the job: static void XML_TEST(Args _args) { XmlDocument xmlDocument = new XmlDocument(); XmlDeclaration xmlDeclaration; XmlElement xmlNodeRoot; XmlElement xmlNodeParrent; XmlElement xmlNodeElement; XmlText xmlText; ; // Create the XML declaration: xmlDeclaration = xmlDocument.CreateXmlDeclaration("1.0","utf-8", ""); xmlDocument.InsertBefore(xmlDeclaration, xmlDocument.documentElement()); // Create the root node: xmlNodeRoot = xmlDocument.CreateElement("CustAccountStatementExt"); xmlNodeRoot.SetAttribute("xmlns", "http://www"); xmlDocument.AppendChild(xmlNodeRoot); // Create the first parrent node: xmlNodeParrent = xmlDocument.CreateElement("Customer"); xmlNodeParrent.SetAttribute("xmlns", "http://www"); xmlNodeRoot.AppendChild(xmlNodeParrent); // Create the first element in the Customer parremnt node: xmlNodeElement = xmlDocument.CreateElement("CustAccount"); xmlNodeParrent.AppendChild(xmlNodeElement); xmlText = xmlDocument.CreateTextNode("4000"); xmlNodeElement.AppendChild(xmlText); // Save the XML file: xmlDocument.save("c:\\xmlTest.xml"); }

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.