Validating using external DTD

A

Anand

Hi all,
I have an XML which comes through a HTTP request. I want to
validate that
XML with a DTD in the local machine. That XML does not have a DOCTYPE
element by itself. Can someone tell me how this can be accomplished
using
xerces java.

I had tried the sample "XMLGrammarBuilder.java" which comes with the
xerces
package. But this one seems to validate the XML only if it had the
DOCTYPE
element referencing the DTD. If I removed the DOCTYPE from the XML and
ran
the program, it gives an error such as "[Error] test.xml:2:12:
cvc-elt.1: Cannot find the declaration of element
'<the_root_element>'". But the XML is valid.

If someone has a sample, it would be of great help if you can share it
with
me.

Thanks,
Anand
 

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

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top