1

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>

1 Answer 1

2
document.getElementsByTagName("*");

matches all elements.

See javadocs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.