parsing xml to find elements in java
I have to parse an xml document and have to get all the elements in the same. I have gone through example, where they are just providing the element name. I do not want to give the element name manually. So how could I get all the elements? I am having only the method name getElementsByTagName(elementName). Is there any other method to get the elements?
<开发者_运维技巧;bookmap>
<booktitle>
<mainbooktitle>GMAT in a BOX </mainbooktitle>
</booktitle>
<frontmatter>
<notices href="Topics/ref_GMAT_box_notices.dita"/>
<topicref href="Topics/con_GMAT_box_instructions.dita"/>
</frontmatter>
<chapter href="comp_verbal.ditamap" format="ditamap"/>
<chapter href="comp_math.ditamap" format="ditamap"/>
</bookmap>
document.getElementsByTagName("*");
matches all elements.
See javadocs.
精彩评论