I'm trying to select the value of a specific node "effectiveintervalstart"
from the XML below (pasted all the way on the bottom since it's long).
Here's my code:
//the XML is returned into req.responseXML.xml
var result = req.responseXML.xml.toString();
var doc = new ActiveXObject("MSXML2.DOMDocument");
doc.async = false;
doc.loadXML(result);
var arrayAnswers = [];
var arr = doc.selectNodes("//b:effectiveintervalstart");
for (var i = 0, len = arr.length; i < len; i++) {
arrayAnswers[i] = arr.nextNode.text;
}
alert(arrayAnswers);
alert(arrayAnswers.length)
However so far this is returning an empty array instead.
This is my XML.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<RetrieveMultipleResponse xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<RetrieveMultipleResult xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Entities>
<a:Entity>
<a:Attributes xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>calendarid</b:key>
<b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">933d2b7d-0e7c-e211-a14f-78e7d1620f84</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>calendarrules</b:key>
<b:value i:type="a:EntityCollection">
<a:Entities>
<a:Entity>
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>calendarruleid</b:key>
<b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">b77b4621-3774-e411-80db-005056971aab</b:value>
</a:KeyValuePairOfstringanyType>
/* this node */
<a:KeyValuePairOfstringstring>
<b:key>effectiveintervalstart</b:key>
<b:value>11/26/2014</b:value>
</a:KeyValuePairOfstringstring>
/* */
<a:KeyValuePairOfstringstring>
<b:key>rank</b:key>
<b:value>0</b:value>
</a:KeyValuePairOfstringstring>
Thank you very much for your help, much appreciated. .