public static server XML daxXMLTest(str _custOrderXmlStr)
{
XmlDocument custOrderXml;
XmlElement xmlRoot;
XmlElement xmlRecord;
str orderType;
XmlNode xmlNode;
XmlNodeList xmlRecordList;
RecId lineRecId;
int i;
custOrderXml = new XmlDocument();
custOrderXml.loadXml(_custOrderXmlStr);
xmlRoot = custOrderXml.documentElement().getNamedElement('Items');
xmlRecordList = xmlRoot.childNodes();
// Grab a value
xmlNode = custOrderXml.documentElement().selectSingleNode('OrderType');
orderType = xmlNode.text();
if(xmlRecordList)
{
// Cycle through the items in the incoming XML
for (i = 0; i < xmlRecordList.length(); i++)
{
// Grab the item in the XML that corresponds to the iteration number
xmlRecord = xmlRecordList.item(i);
// Parse out local variables
lineRecId = str2int64(xmlRecord.getAttribute('RecId'));
...
// Do the magic
...
// Change value in the XML that was sent to AX so we can return it with new values
// I'm setting the example 'newValue' to true just out of simplicity
newValue = true;
xmlRecord.setAttribute('NodeToChange', newValue);
}
}
}
return custOrderXml.toString();
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.