This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes XML Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "XML Validation" Watch "XML Validation" New topic
Author

XML Validation

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Hi - I'm trying to validate an XML document against an XSD document. I'm currently using Xerces-J. I've found that I can turn on validation by setting a validation feature and then setting a property pointing to my XSD document. But, when I run the parser, I get errors about my DOCROOT being incorrect because it doesn't point to a DTD file (I actually don't have a DOCROOT tag at all in my XML doc). I'm trying to validate against an XSD, NOT a DTD. Is there a way to do this?

Thanks,
Jeff
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Welcome to JavaRanch,

the Question is more related to the XML is better to post XML and Related Technologies forum to get faster reply.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Thanks!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3418
    
  12
Do you check for exceptions when you turn on schema validation and specify your schema file ? It may be that the version of Xerces you have doesn't support schema validation.


Joanne
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
No exceptions are being thrown (aside from the DTD error) and it looks like it is actually validating against the XSD as well.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML Validation
 
Similar Threads
XML Validation
XML Validation
Validation - best approach
XML Schema Help
DTD Validation Using an Editor