Saturday, April 16, 2016

IMPORT XML : IMPORT DATA FROM XML : MICROSOFT DYNAMICS AX 2012

EXPORT DATA INTO XML : MICROSOFT DYNAMICS AX 2012

class ReadXmlFile
{
}
public static void main(Args _args)
{
XmlDocument doc;
XmlNodeList data;
XmlElement nodeTable;
XmlElement nodeAccount;
XmlElement nodeName;
#define.filename(@'C:\accounts.xml')
doc = XmlDocument::newFile(#filename);
data = doc.selectNodes('//'+tableStr(MainAccount)); nodeTable = data.nextNode();
while (nodeTable)
{
nodeAccount = nodeTable.selectSingleNode( fieldStr(MainAccount, MainAccountId));
nodeName = nodeTable.selectSingleNode(
fieldStr(MainAccount, Name));
info(strFmt(
"%1 - %2",
nodeAccount.text(), nodeName.text()));
nodeTable = data.nextNode();
}
}

Run the class.

The XML file accounts.xml will be created in the specified folder.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...