[xmljs-users] Re: xmljs-users digest, Vol 1 #69 - 2 msgs
Brought to you by:
djoham,
witchhunter
From: James S. E. <jam...@co...> - 2005-08-06 17:07:13
|
James, Try something like this: rows = doc.getElementsByTagName('row'); for (i=0;i<rows.length;i++) { cells = row.childNodes.items(i).getElementsByTagName('cell'); for (j=0;j<cells.length;j++) { val = cells.items(j).value; // do something with the value here } } That's just the basic algorithm off the top of my head. You will probably have to get the content of the first node of each cell element, which will be a textNode, and convert it to a JavaScript type. Perhaps someone else here could expound on that. -- James >> >>How can I iterate through the XML, reading each row, and then each cell? I >>started off by searching for a command along the lines of >>getNextNode/getNextChildNode, etc., but I am stumped on how to do this. All >>the examples seem to point to specific (known) nodes, and unique nodes at >>that. >> |