Hi I am trying to parse an XML file which has the data I need in an array, as follows:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="
http://xml.apache.org/xml-soap">
<SOAP-ENV:Body>
<ns1:cwCustomerMassInfoCustMassInfoResponse>
<result xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">orderDate</key>
<value xsi:type="xsd:string">2012-07-01</value>
</item>
<item>
<key xsi:type="xsd:string">custListIds</key>
<value SOAP-ENC:arrayType="xsd:string[21]" xsi:type="SOAP-ENC:Array">
<item xsi:type="xsd:string">5132</item>
<item xsi:type="xsd:string">5196</item>
<item xsi:type="xsd:string">5446</item>
<item xsi:type="xsd:string">5840</item>
<item xsi:type="xsd:string">5861</item>
<item xsi:type="xsd:string">6308</item>
<item xsi:type="xsd:string">6515</item>
<item xsi:type="xsd:string">6870</item>
<item xsi:type="xsd:string">7356</item>
<item xsi:type="xsd:string">8749</item>
<item xsi:type="xsd:string">9361</item>
<item xsi:type="xsd:string">9906</item>
<item xsi:type="xsd:string">10240</item>
<item xsi:type="xsd:string">10413</item>
<item xsi:type="xsd:string">10600</item>
<item xsi:type="xsd:string">12588</item>
<item xsi:type="xsd:string">15453</item>
<item xsi:type="xsd:string">16704</item>
<item xsi:type="xsd:string">16937</item>
<item xsi:type="xsd:string">17412</item>
<item xsi:type="xsd:string">18063</item>
</value>
</item>
</result>
</ns1:cwCustomerMassInfoCustMassInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I need the data enclosed in <item> , eg: <item xsi:type="xsd:string">18063</item>. Up till now, I have managed to parse until this line
<value SOAP-ENC:arrayType="xsd:string[21]" xsi:type="SOAP-ENC:Array">
using this code...
XMLNodeList := XMLDOM.selectNodes('//value');
IF XMLNodeList.item(1).hasChildNodes THEN BEGIN
XMLNodeList2 := XMLNodeList.item(1).childNodes;
FOR eachNode := 0 TO XMLNodeList2.length - 1 DO BEGIN
XMLNode2 := XMLNodeList2.item(eachNode);
result := GetReturnValueNode('item', XMLNode2);
END;
END;
However, the result variable is remaining empty, and I need to have it filled with the data inside <item>, e.g. 5132. This is my first time dealing with XML in NAV and I've been stuck since Friday (yes I know it's ridiculous). I would rlyyyy appreciate if anyone helped me. Thanks