• Post Reply Bookmark Topic Watch Topic
  • New Topic

IN Memory DOM document validation

 
prashant patel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is there a way to validation a DOM docuement which i created in memory(on loaded from a file) and validate is against a DTD. I am using the
"SYSTEM" in DOCTYPE which point to a directory containing a DTD.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to run the XML document through DocumentBuilder#parse() so that the DocumentBuilder in question is a validating parser.

I.e.

If the document doesn't validate against its DTD, the parse() method throws an exception.
 
prashant patel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks will try that.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!