Package nu.xom.converters
Class SAXConverter
java.lang.Object
nu.xom.converters.SAXConverter
Feeds a XOM Document into a
SAX2 ContentHandler.
- Version:
- 1.1b2
- Author:
- Elliotte Rusty Harold
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFeed a document through this converter.voidConverts aNodeslist into SAX by firing events into the registered handlers.Returns the content handler.Returns theLexicalHandlerfor this converter.voidsetContentHandler(ContentHandler handler) Set the content handler for this converter.voidsetLexicalHandler(LexicalHandler handler) Sets the optional lexical handler for this converter.
-
Constructor Details
-
SAXConverter
Creates a new
SAXConverter.- Parameters:
handler- the SAX2 content handler that receives the data- Throws:
NullPointerException- if handler is null
-
-
Method Details
-
setContentHandler
Set the content handler for this converter.
- Parameters:
handler- SAX2 content handler that receives the data- Throws:
NullPointerException- if handler is null
-
getContentHandler
Returns the content handler.
- Returns:
- SAX2 content handler that receives the data
-
setLexicalHandler
Sets the optional lexical handler for this converter. The only lexical events the converter supplies are comments.
- Parameters:
handler- the lexical handler; may be null to turn off lexical events
-
getLexicalHandler
Returns the
LexicalHandlerfor this converter. This is only used for comments.- Returns:
- SAX2 lexical handler that receives lexical events
-
convert
Feed a document through this converter.
- Parameters:
doc- the document to pass to SAX- Throws:
SAXException- if the content handler or lexical handler throws an exception
-
convert
Converts a
Nodeslist into SAX by firing events into the registered handlers. This method callsstartDocumentbefore processing the list of nodes, and callsendDocumentafter processing all of them.- Parameters:
nodes- the nodes to pass to SAX- Throws:
SAXException- if the content handler or lexical handler throws an exception
-