public class SAXConverter
extends Object
Feeds a XOM Document
into a
SAX2 ContentHandler
.
Constructor and Description |
---|
SAXConverter(org.xml.sax.ContentHandler handler)
Creates a new
SAXConverter . |
Modifier and Type | Method and Description |
---|---|
void | convert(Document doc)
Feed a document through this converter.
|
void | convert(Nodes nodes)
Converts a
Nodes list into SAX by firing events
into the registered handlers. |
org.xml.sax.ContentHandler | getContentHandler()
Returns the content handler.
|
org.xml.sax.ext.LexicalHandler | getLexicalHandler()
Returns the
LexicalHandler for this
converter. |
void | setContentHandler(org.xml.sax.ContentHandler handler)
Set the content handler for this converter.
|
void | setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Sets the optional lexical handler for this converter.
|
public SAXConverter(org.xml.sax.ContentHandler handler)
Creates a new SAXConverter
.
handler
- the SAX2 content handler
that receives the dataNullPointerException
- if handler is nullpublic void setContentHandler(org.xml.sax.ContentHandler handler)
Set the content handler for this converter.
handler
- SAX2 content handler that
receives the dataNullPointerException
- if handler is nullpublic org.xml.sax.ContentHandler getContentHandler()
Returns the content handler.
public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Sets the optional lexical handler for this converter. The only lexical events the converter supplies are comments.
handler
- the lexical handler;
may be null to turn off lexical eventspublic org.xml.sax.ext.LexicalHandler getLexicalHandler()
Returns the LexicalHandler
for this
converter. This is only used for comments.
public void convert(Document doc) throws org.xml.sax.SAXException
Feed a document through this converter.
doc
- the document to pass to SAXorg.xml.sax.SAXException
- if the content handler
or lexical handler throws an exceptionpublic void convert(Nodes nodes) throws org.xml.sax.SAXException
Converts a Nodes
list into SAX by firing events
into the registered handlers. This method calls
startDocument
before processing the list
of nodes, and calls endDocument
after processing
all of them.
nodes
- the nodes to pass to SAXorg.xml.sax.SAXException
- if the content handler
or lexical handler throws an exceptionCopyright 2002-2023 Elliotte Rusty Harold
elharo@ibiblio.org