This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • 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