Package org.dom4j.io
Class SAXValidator
- java.lang.Object
 - 
- org.dom4j.io.SAXValidator
 
 
- 
public class SAXValidator extends Object
SAXValidatorvalidates an XML document by writing the document to a text buffer and parsing it with a validating SAX parser. This could be implemented much more efficiently by validating against the dom4j object model directly but at least allows the reuse of existing SAX based validating parsers. 
- 
- 
Constructor Summary
Constructors Constructor Description SAXValidator()SAXValidator(XMLReader xmlReader) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigureReader()Configures the XMLReader before useprotected XMLReadercreateXMLReader()Factory Method to allow alternate methods of creating and configuring XMLReader objectsErrorHandlergetErrorHandler()DOCUMENT ME!XMLReadergetXMLReader()DOCUMENT ME!voidsetErrorHandler(ErrorHandler errorHandler)Sets theErrorHandlerused by the SAXXMLReader.voidsetXMLReader(XMLReader reader)Sets theXMLReaderused to parse SAX eventsvoidvalidate(Document document)Validates the givenDocumentby writing it to a validating SAX Parser. 
 - 
 
- 
- 
Constructor Detail
- 
SAXValidator
public SAXValidator()
 
- 
SAXValidator
public SAXValidator(XMLReader xmlReader)
 
 - 
 
- 
Method Detail
- 
validate
public void validate(Document document) throws SAXException
Validates the givenDocumentby writing it to a validating SAX Parser.- Parameters:
 document- is the Document to validate- Throws:
 SAXException- if a validation error occursRuntimeException- DOCUMENT ME!
 
- 
getXMLReader
public XMLReader getXMLReader() throws SAXException
DOCUMENT ME!- Returns:
 - the 
XMLReaderused to parse SAX events - Throws:
 SAXException- DOCUMENT ME!
 
- 
setXMLReader
public void setXMLReader(XMLReader reader) throws SAXException
Sets theXMLReaderused to parse SAX events- Parameters:
 reader- is theXMLReaderto parse SAX events- Throws:
 SAXException- DOCUMENT ME!
 
- 
getErrorHandler
public ErrorHandler getErrorHandler()
DOCUMENT ME!- Returns:
 - the 
ErrorHandlerused by SAX 
 
- 
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
Sets theErrorHandlerused by the SAXXMLReader.- Parameters:
 errorHandler- is theErrorHandlerused by SAX
 
- 
createXMLReader
protected XMLReader createXMLReader() throws SAXException
Factory Method to allow alternate methods of creating and configuring XMLReader objects- Returns:
 - DOCUMENT ME!
 - Throws:
 SAXException- DOCUMENT ME!
 
- 
configureReader
protected void configureReader() throws SAXExceptionConfigures the XMLReader before use- Throws:
 SAXException- DOCUMENT ME!
 
 - 
 
 -