SelectNodes, SelectSingleNode weirdness
Hello,
I'm seeing some weirdness that may just because i've been staring at it entirely too long. I have some xml that has a section similar to this
<link currentlink="Yes" linkname="Current Link">
<leased_bw unit="Khz" value="3549.9"></leased_bw>
<month_bw savings="1468.9103448275864" percent="13.8" payback_period="10.211651141826922"></month_bw>
</link>
<link currentlink="No" linkname="New Link">
<leased_bw unit="Khz" value="3060.2" current="3549.9"></leased_bw>
<month_bw savings="1468.9103448275864" percent="13.8" payback_period="10.211651141826922"></month_bw>
</link>
I have some code that looks like this:
var nodeLinks = oXmlDomCalcNetwork.selectNodes("//linkcalc//link");
var i;
var nodeLink;
var nodeLink2;
nodeLink = nodeLinks[0];
document.getElementById('txtLinkName').value = nodeLink.getAttribute("linkname");
nodeLink2 = nodeLinks[1];
document.getElementById('text1').value = nodeLink2.xml;
var nodeLeasedBWNew = nodeLink2.selectSingleNode("//leased_bw");
document.getElementById('txtNewLinkLB').value = nodeLeasedBWNew.getAttribute("value");
Nodelink works fine, i can parse out values from the XML just fine. nodelink2 works partially. I am writing out the conents of it, and it is parsing the correct nodes from the XML, but when i try to get the "value" attribute, i get the value attribute from nodelinks[0] instead of nodelink[1].
I've downloaded the latest zxml update.. and still no luck. I cant see what i'm doing wrong..
Any ideas?
|