Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes XML validation issue in Xerces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML validation issue in Xerces" Watch "XML validation issue in Xerces" New topic
Author

XML validation issue in Xerces

nilesh shah
Greenhorn

Joined: May 25, 2006
Posts: 10
Hi,

I am using Xerces-2.8. I have a problem to load the schema file to validate the XML.

The validation worked when I was using an absolute path for the schema location. Is there any way I can use path relative to my context root in this example?

parser.setProperty(
"http://apache.org/xml/properties/schema/external-schemaLocation",
"http://test.com/web/management/request C:\management.xsd");

But the same code has to be ported on Linux/Unix servers, I tried to give path relative to context root, and placed the xsd file under that path, but it doesn't seem to load the XSD file. For example I tried to put

management.xsd under WEB-INF/classes and tried

parser.setProperty(
"http://apache.org/xml/properties/schema/external-schemaLocation",
"http://test.com/web/management/request /WEB-INF/classes/management.xsd");

I could use system property to set the path and track down my XSD file, but I wanted to know if there is a way without system property setting.
Any help will be appreciated. Thanks in advance,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML validation issue in Xerces
 
Similar Threads
How to validate XML against DTD / Schema using DOM
xml validation agains xsd
Feature not recognized: - schema validation
XML Schema parsing
SAX parse and validate with XSD