Title: Validate method of SAXValidator
Thanks James, I will surely check out the JARV. Meanwhile, I have used SAXValidator as following:
(SAXErrorHandler extends DefaultHandler, p_doc is org.dom4j.Document and p_xsdPath is XSD location path)
 
 
XMLReader  reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser") ; 
reader.setFeature("http://xml.org/sax/features/validation", true) ;
reader.setFeature("http://apache.org/xml/features/validation/schema", true) ;
reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",  p_xsdPath );
SAXErrorHandler handler = new SAXErrorHandler() ;
reader.setContentHandler(handler) ;
reader.setErrorHandler(handler) ;
 
SAXValidator validator = new SAXValidator();
validator.setXMLReader(reader) ;
validator.validate(p_doc) ;
 
 
  
 
-----Original Message-----
From: James Strachan [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 9:46 AM
To: Rathore, Ritesh (GECP, TEMP, 096462); [EMAIL PROTECTED]
Subject: Re: [dom4j-dev] Validate method of SAXValidator

You're best course of action is to try using JARV to perform the validation - this avoids turning a Document into text so that it can be reparsed again with valiation on.
 
There's a demo of using JARV (and Sun's MSV implementation of JARV) in the samples directory.
 
dom4j/src/samples/validate/
    JARVDemo.java
 
You can use this mechanism to validate against DTD, XSD or RelaxNG
----- Original Message -----
Sent: Tuesday, December 10, 2002 4:39 PM
Subject: [dom4j-dev] Validate method of SAXValidator

I would like to know how to use Validate(Document) method of org.dom4j.io.SAXValidator.
I am getting a org.dom4j.Document in response to a SOAP call to another application and I want to validate this document against a XSD. Can I somehow use this method to do that?

Thanks
Ritesh

Reply via email to