I am new to XML and DOM. I think I need to use the DOM API to find one pass through each non-text node once and print the name node.
say I got this XML example from W3C
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
<page pagenumber="550"/>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
<page pagenumber="500"/>
</book>
</bookstore>
I need to find a node, for example <page pagenumber="500" />, which is a non-text node
How can i do this? seduo-code will be fine too. thanks
can say
while (x.nodeValue == NULL) {
read the next node ?
}
I suppose that I should make myself clear, no assumptions about any documents. This should work on all XML if there is a non-text node. I assume this should be done in order from top to bottom and from left to right for each node .:(
source
share