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]



Reply via email to