Home > X++ stuffs > Reading Selected Node in XML – Dynamics AX2012

Reading Selected Node in XML – Dynamics AX2012

Case Study: Below a sample job is illustrated to read selected (multiple) nodes from a given XML.

private static void SR_ReadSelectedNode_XML(Filename fileName)
    XmlDocument xmlDocument;
    XmlNode     xmlInformationNode;
    XmlNodeList xmlInformationsNodeList;
    XmlNodeList xmlChildNodeList;
    int         i;
    int         j;

    fileName                = @'C:\Projects\ReadNode.xml';
    xmlDocument             = xmlDocument::newFile(fileName);
    xmlInformationsNodeList = xmlDocument.documentElement()

    for ( i = 0; i < xmlInformationsNodeList.length(); i++)
        xmlChildNodeList = xmlInformationsNodeList.item(i)
        for (j = 0; j < xmlChildNodeList.length() ; j++) 
            xmlInformationNode = xmlChildNodeList.item(j);

            if (xmlInformationNode.baseName() == 'DETAILS')

Happy dAX(ml)ING 🙂 😛

Categories: X++ stuffs
  1. August 25, 2012 at 6:54 pm

    good one. You can also use “Xpath” to create more standardized implementations and more flexible searchs http://www.w3schools.com/xpath/default.asp

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: