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));
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