开发者

parsing xml to find elements in java

开发者 https://www.devze.com 2023-02-05 15:32 出处:网络
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 manual

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消