web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Read XML file through x++ code in ax09

(0) ShareShare
ReportReport
Posted on by

Hi guys ,

when i m trying to read xml code through ax code , m getting error as :

XMLNode object not initialized.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    We can't help you, if you don't share your code. The error says all there is to say. Maybe you specified a wrong xPath and don't get a XML node...

  • Community Member Profile Picture
    on at

    select * from Staging

       where Staging.RecId == 5637144581;

       _xmlMsg = Staging.OrderJson;

       doc = new XmlDocument();

       doc.loadXml(_xmlMsg);

       xmlError  = doc.parseError();

       if(xmlError && xmlError.errorCode() != 0)

       {

           throw error(strFmt("XML Error: %1", xmlError.reason()));

       }

       //rootNode = doc.documentElement();

       nodeNote = doc.documentElement().getNamedElement("name");

       //rootNode = doc.getNamedElement(#paramsNode);

       xmlRecordList = nodeNote.childNodes();

  • Community Member Profile Picture
    on at

    It should be really easy to identify the problem using the debugger.

    Which line produces the error?

    I assume it's

    xmlRecordList = nodeNote.childNodes();

    which means that there is not element with the name 'name', so the getNamedElement() functions returns null (no object) and you can't access childNodes() method of an uninstatiated object.

    Check your XML structure and write your code accordingly.

    www.w3schools.com/.../default.asp

    msdn.microsoft.com/.../System.Xml%28v=vs.110%29.aspx

    msdn.microsoft.com/.../system.xml.xmldocument%28v=vs.110%29.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans