Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XML validation with XSD, Cannot find the declaration of element 'rules'

843834Dec 19 2007 — edited Aug 25 2010
i am able to validate xml with XSD, from windows env, but same is not doing with linux, it is throwing error Cannot find the declaration of element 'rules'
code here is
validate(String aFilePath, String aSchemaFilePath)
final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
		final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
		final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
if(lSchemaFilePath == null){
}
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(aSchemaFilePath));
factory.setNamespaceAware(true);
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
mValidator = new ValidationHandler();
builder.setErrorHandler(mValidator);
lDocument = builder.parse(aFilePath);
if(mValidator.mErrorExist){
		}
Thanks
vittal
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2010
Added on Dec 19 2007
5 comments
1,562 views