Unwanted HTML tags inserted when using DOMParser (Java)

B

badgerduke

I am trying to parse well-formed XML into Document objects. I thought
the parser would figure out that there was a document root, but it
assumes the root to be <HTML> with a child element of <BODY> which in
turn has as a child the XML I actually parsed.
Unfortunately, I am not allowed to show code but it goes like this:

<nms:MyRoot>
.....
</nms:MyRoot>

is parsed using org.apache.xerces.parsers.DOMParser and comes out as:

<HTML>
<BODY>
<NMS:MYROOT>
....
</NMS:MYROOT>
</BODY>
</HTML>

This has never happened to me before. What is even more strange is
this:

Element originalRoot = (Element) ((NodeList)
parsedDoc.getElementsByTagNameNS("NMS", "MYROOT")).item(0);

originalRoot evaluates to null!

Nothing about my code suggests HTML . . . its just a few lines I've
typed before. any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top