File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Product and Other Certifications and the fly likes XML verifying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "XML verifying" Watch "XML verifying" New topic

XML verifying

Genefer Bruns

Joined: Oct 17, 2006
Posts: 25
Hi All,

I have a problem described as following:
Let a XML document called D1, now, if a have another XML document called D2, I need a mechanism for verifying that D2 is derived from D1, in other words how we can verify (tool, mechanism, algorithm, etc) that D2 respect the DTD (Document Type Definition) of D1.

Thanks in advance.
vipul patel
Ranch Hand

Joined: Oct 16, 2005
Posts: 146
you can use XML parsers to validate your xml instance document against either DTD or Schema.

xerces is best example of such parser. Try running sax.Counter which will validate your xml document.

you might have to download xerces jar package from

java sax.Counter example.xml
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Just validate D2 against the DTD of D1.

Rahul Bhattacharjee
LinkedIn - Blog
I agree. Here's the link:
subject: XML verifying
It's not a secret anymore!