Validation of XML document % DTD

I need method which allows to check if an XML document is valid regards its DTD. is it possible? I use JDOM.thanks,
[136 byte] By [Cordiala] at [2007-11-27 3:03:34]
# 1
No one to help me...
Cordiala at 2007-7-12 3:47:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
You can not use JDOM for XML validation DOM is for parsing XML document not validation for validation you can use DTD(as you mentioned) or XSD.Read some DTD document is it pretty easy
RezaRavasizadeha at 2007-7-12 3:47:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

> I need method which allows to check if an XML

> document is valid regards its DTD. is it possible?

> I use JDOM.

But it would be the parser that validates the XML against its DTD. JDOM is not a parser, it uses some other product (which you can specify, I believe) to do the parsing. So the answer would be yes, since parsers do exist that can validate against a DTD.

DrClapa at 2007-7-12 3:47:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

in fact, I have a DTD, and

in my java code, I products an XML document using DOM.

I hope now (using java) validate the XML against the defined DTD.

can you give me one parser wich can be able to do the validation step? or a link to online document which discribs it ...

thanks,

Cordiala at 2007-7-12 3:47:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

The online document which describes that is the JDOM FAQ:

http://www.jdom.org/docs/faq.html#a0370

While you are waiting for them to implement that feature, the thing to do is to output the DOM to an XML document, and include the reference to the DTD you want to validate against. Then feed that document into a parser in validating mode.

DrClapa at 2007-7-12 3:47:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
ok, thank you !
Cordiala at 2007-7-12 3:47:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...