Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript - xpath - xml

Status
Not open for further replies.

sezme

Programmer
Oct 31, 2003
26
0
0
GB
I have an xml document that i have loaded into ie

var xmlDoc = new ActiveXObject("msxml2.DOMDocument.3.0");
xmlDoc.async = false;xmlDoc.resolveExternals = false;xmlDoc.validateOnParse = false;
xmlDoc.load("area.xml");

I then run a xpath query on it
att = Area
value = 20
var nH=xmlDoc.selectNodes("/xml/rs:data/z:row[@"+ att +"='"+ value +"']")

this is working fine

now what i want to do is create a select menu from the data queried from the xml file

this is where i am struggling
i know that nH.length value is correct it returns 9 in this example

//alert(nH.length)

for(var i=0;i<nH.length;i++){

nH = nH.nextNode;
alert(nH.attributes.getNamedItem(&quot;City&quot;).value)

}

but this will not iterate - the alert box will only show once.

can anyone explain this to me ?

thanks in advance



 
I found a crazy thing when I was working with XML in IE6 maybe it will help you.

Any time I changed anything I had to close the browser and open a new one. Otherwise it would get stuck with old information no matter how many times I refreshed, or cleared the cache.

I was using VBSCRIPT to create XML so that may be a different problem, but it's worth a try.


Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top