public class SAXValidator
extends java.lang.Object
SAXValidator
validates 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 and Description |
---|
SAXValidator() |
SAXValidator(org.xml.sax.XMLReader xmlReader) |
Modifier and Type | Method and Description |
---|---|
protected void |
configureReader()
Configures the XMLReader before use
|
protected org.xml.sax.XMLReader |
createXMLReader()
Factory Method to allow alternate methods of creating and configuring
XMLReader objects
|
org.xml.sax.ErrorHandler |
getErrorHandler()
DOCUMENT ME!
|
org.xml.sax.XMLReader |
getXMLReader()
DOCUMENT ME!
|
void |
setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
Sets the
ErrorHandler used by the SAX
XMLReader . |
void |
setXMLReader(org.xml.sax.XMLReader reader)
Sets the
XMLReader used to parse SAX events |
void |
validate(Document document)
Validates the given
Document by writing it to a validating
SAX Parser. |
public SAXValidator()
public SAXValidator(org.xml.sax.XMLReader xmlReader)
public void validate(Document document) throws org.xml.sax.SAXException
Document
by writing it to a validating
SAX Parser.document
- is the Document to validateorg.xml.sax.SAXException
- if a validation error occursjava.lang.RuntimeException
- DOCUMENT ME!public org.xml.sax.XMLReader getXMLReader() throws org.xml.sax.SAXException
XMLReader
used to parse SAX eventsorg.xml.sax.SAXException
- DOCUMENT ME!public void setXMLReader(org.xml.sax.XMLReader reader) throws org.xml.sax.SAXException
XMLReader
used to parse SAX eventsreader
- is the XMLReader
to parse SAX eventsorg.xml.sax.SAXException
- DOCUMENT ME!public org.xml.sax.ErrorHandler getErrorHandler()
ErrorHandler
used by SAXpublic void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
ErrorHandler
used by the SAX
XMLReader
.errorHandler
- is the ErrorHandler
used by SAXprotected org.xml.sax.XMLReader createXMLReader() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- DOCUMENT ME!protected void configureReader() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- DOCUMENT ME!