org.dom4j.io

Class SAXValidator

public class SAXValidator extends 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.

Version: $Revision: 1.10 $

Author: James Strachan

Constructor Summary
SAXValidator()
SAXValidator(XMLReader xmlReader)
Method Summary
protected voidconfigureReader()
Configures the XMLReader before use
protected XMLReadercreateXMLReader()
Factory Method to allow alternate methods of creating and configuring XMLReader objects
ErrorHandlergetErrorHandler()
DOCUMENT ME!
XMLReadergetXMLReader()
DOCUMENT ME!
voidsetErrorHandler(ErrorHandler errorHandler)
Sets the ErrorHandler used by the SAX XMLReader.
voidsetXMLReader(XMLReader reader)
Sets the XMLReader used to parse SAX events
voidvalidate(Document document)
Validates the given Document by writing it to a validating SAX Parser.

Constructor Detail

SAXValidator

public SAXValidator()

SAXValidator

public SAXValidator(XMLReader xmlReader)

Method Detail

configureReader

protected void configureReader()
Configures the XMLReader before use

Throws: SAXException DOCUMENT ME!

createXMLReader

protected XMLReader createXMLReader()
Factory Method to allow alternate methods of creating and configuring XMLReader objects

Returns: DOCUMENT ME!

Throws: SAXException DOCUMENT ME!

getErrorHandler

public ErrorHandler getErrorHandler()
DOCUMENT ME!

Returns: the ErrorHandler used by SAX

getXMLReader

public XMLReader getXMLReader()
DOCUMENT ME!

Returns: the XMLReader used to parse SAX events

Throws: SAXException DOCUMENT ME!

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Sets the ErrorHandler used by the SAX XMLReader.

Parameters: errorHandler is the ErrorHandler used by SAX

setXMLReader

public void setXMLReader(XMLReader reader)
Sets the XMLReader used to parse SAX events

Parameters: reader is the XMLReader to parse SAX events

Throws: SAXException DOCUMENT ME!

validate

public void validate(Document document)
Validates the given Document by writing it to a validating SAX Parser.

Parameters: document is the Document to validate

Throws: SAXException if a validation error occurs RuntimeException DOCUMENT ME!

Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge