Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Getting error while loading xml documents in AX

$
0
0

In the below code xml document is not getting loaded and throwing exception has been thrown by the target of an invocation.


classreadXML

{       

    

    publicstaticvoid main(Args _args)

    {

        XmlDocument  doc= newXmlDocument();

        XmlNodeList         apiModelList;

        XmlNodeListIterator iterator;

        XmlElement          apiModel;

        XmlElement          firstName;

        XmlElement          lastName;

        //str s= @"C:\Users\Administrator\Desktop\Assessment.xml";

        doc.load(@"C:\Users\Administrator\Desktop\Assessment.xml");

        apiModelList = doc.getElementsByTagName('ItemGroup');

        iterator= newXmlNodeListIterator(apiModelList);

        while (iterator.moreValues())

        {

            apiModel = iterator.value();

       

            firstName = apiModel.getNamedElement('Link');

            if (firstName)

            {

                info(strFmt("First Name: %1", firstName.text()));

            }

       

            //lastName = apiModel.getNamedElement('LastName');

            //if (lastName)

            //{

            //    info(strFmt("Last Name: %1", lastName.text()));

            //}

            iterator.nextValue();

        }

      

    }

}

 


Viewing all articles
Browse latest Browse all 143529

Trending Articles