These days there are lot of requirements on Integration with other systems like in import data and export data. One of the means is XML .
Here is a small job to read an XML file in AX
static void ReadingXMLFile(Args _args)
{
XMLDocument XMLdoc = XMLDocument::newFile(@"C:\Users\AxUser\Desktop\Items.xml");
int i,CountItemtags;
;
XMLdoc.load(XMLdoc.toString());
info(XMLdoc.getElementsByTagName("number").item(0).text());
info(XMLdoc.getElementsByTagName("name").item(1).toString());
countItemTags = xmldoc.getElementsByTagName('number').length();
info (strfmt('Number of tags with name Item - %1', countItemTags));
for (i = 0 ; i < countItemTags; i++)
{
info ("Item number :" + xmldoc.getElementsByTagName('number').item(i).text());
info ("Item Name :" + xmldoc.getElementsByTagName('name').item(i).text());
}
}
Here is a small job to read an XML file in AX
static void ReadingXMLFile(Args _args)
{
XMLDocument XMLdoc = XMLDocument::newFile(@"C:\Users\AxUser\Desktop\Items.xml");
int i,CountItemtags;
;
XMLdoc.load(XMLdoc.toString());
info(XMLdoc.getElementsByTagName("number").item(0).text());
info(XMLdoc.getElementsByTagName("name").item(1).toString());
countItemTags = xmldoc.getElementsByTagName('number').length();
info (strfmt('Number of tags with name Item - %1', countItemTags));
for (i = 0 ; i < countItemTags; i++)
{
info ("Item number :" + xmldoc.getElementsByTagName('number').item(i).text());
info ("Item Name :" + xmldoc.getElementsByTagName('name').item(i).text());
}
}