• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validating in-memory dom against an external DTD

 
Tomchi Tang
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a new document from scratch using DOM. Before writing it to the file, I want to validate it against a DTD. Any pointers would be appreciated.
Thanks
Tomchi
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could consider using the Validator class from XMLUnit (take a look at the testValidation() method in the examples page).
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course I forgot to mention the other way I had in mind: write the document into a string (appending the doctype reference to the correct place) and feed it to a parser with validation set on.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic