XMLDocument class

XMLDocument class allows to manipulate XML data via DOM.
XMLDocument is a thin wrapper around MSXML in Ax3 and around System.XML .NET framework namespace in Ax4, so use cross refereneces and MSDN to learn about DOM and other stuff.
static void Test_XML(Args _args)
    str xml = @'
                <testname>bla bla</testname>
    XMlDocument doc=XMLDocument::newXML(xml);
    XMLNodeList tests = doc.selectNodes('//test');
    XMLNode node;
    node = tests.nextNode();
    while (node)
        node = tests.nextNode();

[edit]Create a XML Document

You can create you own XML Documents by hand with the XML* Classes. This code creates a XML File with an XML Root element. It has one child element FOO with an attribute BAR. The attributes values is 123. Finally it is stored on C: in file test.xml.
XMLNode         root;
XMLElement      node;
XMLAttribute    attr;
XMLDocument     doc = XMLDOcument::newBlank();
root = doc.createElement("xml");
node = doc.createElement("foo");
The result looks like
   <foo bar="123"/>

No comments:

Post a Comment

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