Package nu.xom.converters
Class SAXConverter
- java.lang.Object
-
- nu.xom.converters.SAXConverter
-
public class SAXConverter extends java.lang.ObjectFeeds a XOM
Documentinto a SAX2ContentHandler.- Version:
- 1.1b2
- Author:
- Elliotte Rusty Harold
-
-
Constructor Summary
Constructors Constructor Description SAXConverter(org.xml.sax.ContentHandler handler)Creates a newSAXConverter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconvert(Document doc)Feed a document through this converter.voidconvert(Nodes nodes)Converts aNodeslist into SAX by firing events into the registered handlers.org.xml.sax.ContentHandlergetContentHandler()Returns the content handler.org.xml.sax.ext.LexicalHandlergetLexicalHandler()Returns theLexicalHandlerfor this converter.voidsetContentHandler(org.xml.sax.ContentHandler handler)Set the content handler for this converter.voidsetLexicalHandler(org.xml.sax.ext.LexicalHandler handler)Sets the optional lexical handler for this converter.
-
-
-
Method Detail
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
Set the content handler for this converter.
- Parameters:
handler- SAX2 content handler that receives the data- Throws:
java.lang.NullPointerException- if handler is null
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
Returns the content handler.
- Returns:
- SAX2 content handler that receives the data
-
setLexicalHandler
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.
- Parameters:
handler- the lexical handler; may be null to turn off lexical events
-
getLexicalHandler
public org.xml.sax.ext.LexicalHandler getLexicalHandler()
Returns the
LexicalHandlerfor this converter. This is only used for comments.- Returns:
- SAX2 lexical handler that receives lexical events
-
convert
public void convert(Document doc) throws org.xml.sax.SAXException
Feed a document through this converter.
- Parameters:
doc- the document to pass to SAX- Throws:
org.xml.sax.SAXException- if the content handler or lexical handler throws an exception
-
convert
public void convert(Nodes nodes) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException- if the content handler or lexical handler throws an exception
-
-