Hi All,
I am trying to read XML data via x++ Code. I have wrote a job which has no errors but still not able to fetch data.
Please Find my code below :
static void KTI_FindStorageId(Args _args)
{
XmlDocument doc = new XmlDocument();
XmlNodeList apiModelList;
XMLNode rootNode;
XmlNodeListIterator iterator;
XmlNodeList xmlResponseList;
XmlNodeList xmlTemplateList;
XmlElement apiModel;
XmlElement firstName;
XmlElement lastName;
XMLParseError xmlError;
str xmlMsg;
int i, j;
// Create the XML Document
doc.load("Purchase.xml");
apiModelList = doc.getElementsByTagName('storageId');
//doc = doc.selectSingleNode('storageId');
iterator= new XmlNodeListIterator(apiModelList);
while (iterator.moreValues())
{
apiModel = iterator.value();
firstName = apiModel.getNamedElement('storageId');
if (firstName)
{
info(strFmt("First Name: %1", firstName.text()));
}
iterator.nextValue();
}
}
/////////////////////////////////////////////////////
In above , I have highlighted a line in red. Please let me know when I debug why it is not assigning any value to XML Element (firstName) in this case.
what is going wrong please let me know