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
|
RE: [dom4j-dev] Validate method of SAXValidator
Rathore, Ritesh (GECP, TEMP, 096462) Mon, 16 Dec 2002 07:22:48 -0800
Title: Validate method of SAXValidator
- [dom4j-dev] Validate method of SAXVal... Rathore, Ritesh (GECP, TEMP, 096462)
- Re: [dom4j-dev] Validate method ... James Strachan
- Rathore, Ritesh (GECP, TEMP, 096462)