nu.xom.converters
Class SAXConverter

java.lang.Object
  extended bynu.xom.converters.SAXConverter

public class SAXConverter
extends java.lang.Object

This class walks a XOM tree, while firing events into a SAX2 ContentHandler.

Version:
1.0d23
Author:
Elliotte Rusty Harold

Constructor Summary
SAXConverter(org.xml.sax.ContentHandler handler)
           Creates a new SAXConverter.
 
Method Summary
 void convert(Document doc)
           Feed a document through this converter.
 org.xml.sax.ContentHandler getContentHandler()
           Returns the ContentHandler.
 org.xml.sax.ext.LexicalHandler getLexicalHandler()
           Returns the LexicalHandler for this converter.
 void setContentHandler(org.xml.sax.ContentHandler handler)
           Set the ContentHandler for this converter.
 void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
           Sets the optional LexicalHandler for this converter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXConverter

public SAXConverter(org.xml.sax.ContentHandler handler)

Creates a new SAXConverter.

Parameters:
handler - SAX2 ContentHandler that receives the data
Throws:
java.lang.NullPointerException - if handler is null
Method Detail

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)

Set the ContentHandler for this converter.

Parameters:
handler - SAX2 ContentHandler that receives the data
Throws:
java.lang.NullPointerException - if handler is null

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()

Returns the ContentHandler.

Returns:
SAX2 ContentHandler that receives the data

setLexicalHandler

public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)

Sets the optional LexicalHandler for this converter. The only lexical events the converter supplies are comments.

Parameters:
handler - the LexicalHandler; may be null to turn off lexical events

getLexicalHandler

public org.xml.sax.ext.LexicalHandler getLexicalHandler()

Returns the LexicalHandler for this converter. This is only used for comments.

Returns:
SAX2 LexicalHandler 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 ContentHandler or LexicalHandler throws an exception


Copyright 2002-2004 Elliotte Rusty Harold
elharo@metalab.unc.edu