XmlDocument
doc;
XmlNodeList xmlScriptList;
XmlNodeList xmlResponseList;
XmlNodeList xmlTemplateList;
XmlElement nodeScript;
XmlElement nodeResponse;
XmlElement nodeTemplate;
XMLParseError xmlError;
str xmlMsg;
int
i, j;
;
// Create the
XML Document
doc = new
XmlDocument();
doc.loadXml(xmlMsg);
// Verify XML
Document Structure
xmlError
= doc.parseError();
if(xmlError
&& xmlError.errorCode() != 0)
{
throw
error(strFmt("XML Error: %1", xmlError.reason()));
}
// Get the
root element and its child nodes
nodeScript = doc.getNamedElement("ns2:return");
xmlScriptList = nodeScript.childNodes();
for(i=0; i < xmlScriptList.length(); i++)
{
nodeResponse = xmlScriptList.item(i);
xmlResponseList =
nodeResponse.childNodes();
for
(j=0; j < xmlResponseList.length();
j++)
{
nodeTemplate =
xmlResponseList.item(j);
xmlTemplateList =
nodeTemplate.childNodes();
if
(nodeTemplate.selectSingleNode('id'))
{
info(strFmt("ID: %1",
nodeTemplate.getNamedElement("id").text()));
}
if
(nodeTemplate.selectSingleNode('messageTemplateName'))
{
info(strFmt("messageTemplateName:
%1", nodeTemplate.getNamedElement("messageTemplateName").text()));
}
}
}