if(SCHEMA_VALIDATION == true)
{
parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation","C:/scheams/myschema.xsd");
parser.setFeature(
"http://apache.org/xml/features/validation/schema",true);
}
else
{
parser.setFeature(
"http://apache.org/xml/features/validation/schema",false);
}
Regards,
Aravind Reddy
WebACE
Tie : 870-5968
Outside : (248) 427-5968
Email : [EMAIL PROTECTED]
Pager : 313 714 5169 or [EMAIL PROTECTED]
Esther Parrilla Endrino
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
-space.com> cc:
Subject: Is possible to validate
an XML file passing the schema as an argument?
10/02/2003 10:09 AM
Please respond to
xerces-j-dev
Hello all,
I would like to validate an XML using Xerces Java 2 not using the path
to the schema that is in the 'xsi:schemaLocation' tag of its root
element but another schema that is passed as an argument...
Is this possible? Do I have to set a new feature?
Currently I am using the following constructor made using the java
samples at apache.org:
public CS_XMLTools(String xmlFile) {
DOMParser parser = new DOMParser();
try {
parser.parse(xmlFile);
parser.setFeature("http://apache.org/xml/features/validation/schema",true);
parser.setFeature("http://xml.org/sax/features/validation",true);
parser.setFeature
("http://apache.org/xml/features/validation/schema-full-checking",true);
// set error handling
parser.setErrorHandler(this.handler);
// create DOM
this.myDocument = parser.getDocument();
// traverse DOM to verify if the file is valid
try {
traverse (myDocument);
}
catch (Exception e) { System.out.println ("Error validating DOM
-->" + e); }
}
catch (Exception e) {
System.out.println("Error creating DOM --> " + e.getMessage());
}
}
Thanks in advance,
esther
--
~ Code matters more than comercials ~
--
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]