我的新XML DOM。我想我需要使用DOM API找到穿过每一个非文本节点,和输出节点名。
说我这个例子从W3C XML
<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>
我需要找到节点如<代码> <页面pagenumber = " 500 " / > < /代码>这是一种非文本节点
我怎么能这样做呢?seduo-code也会没事的。谢谢
我能说
while (x.nodeValue == NULL) {
read the next node ?
}
我想我应该说清楚了,没有在任何docuemnts假设。这应该工作在所有XML只要有一个非文本节点。我想这应该从自上而下,从左到右的顺序对每一个节点。:(