Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes XML and Related Technologies and the fly likes validating in-memory dom against an external DTD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "validating in-memory dom against an external DTD" Watch "validating in-memory dom against an external DTD" New topic
Author

validating in-memory dom against an external DTD

Tomchi Tang
Greenhorn

Joined: Apr 25, 2003
Posts: 15
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could consider using the Validator class from XMLUnit (take a look at the testValidation() method in the examples page).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: validating in-memory dom against an external DTD