RE: loading xsd schema seperately for validating the xml Document

Hi Nitin,

 > Nitin Malhotra wrote...
 > 
 > 
 > Hello All.
 > 
 > The problem : I am trying to validate a xml document which has 
 > inbuilt reference to its xsd schema.
 > but the problem is that the xsd if somewhere on the classpath 
 > and its exact uri is unknown. so the parser
 > is not able to load this xsd file. Meaning this xsd is packed 
 > somewhere in a ear file. 
 > 
 > question : is it possible to load xsd seperately and then ask 
 > DOMParser to use this xsd to validate a certain xml doc. In 
 > context to Java APIs.

Yes, you can load the XMLSchema file externally, using external-schemalocation property (look for the exact property name), if you are using JAXP or Xerces. But, you need to know the exact location of the XMLSchema file. If the schema is in some jar, which is in the classpath, you can try using - 
jar:/file:///home/..../abc.jar!/myschemas/myschema.xsd

Hope that helps.

Cheers,
Rahul.

 > 
 > Thanks for any help,
 > nitin.
 > 
 > 
 > 
 > 

Received on Thursday, 3 April 2003 06:26:40 UTC