org.jdom.output
Class SAXOutputter


public class SAXOutputter

SAXOutputter takes a JDOM tree and fires SAX2 events.

Most ContentHandler callbacks are supported. Both ignorableWhitespace and skippedEntity have not been implemented. The setDocumentLocator callback has been implemented, but the locator object always returns -1 for getColumnNumber and getLineNumber.

The EntityResolver callback resolveEntity has been implemented for DTDs.

At this time, it is not possible to access notations and unparsed entity references in a DTD from a JDOM tree. Therefore, DTDHandler callbacks have not been implemented yet.

The ErrorHandler callbacks have not been implemented, since these are supposed to be invoked when the document is parsed. However, the document has already been parsed in order to create the JDOM tree.

Author:
Brett McLaughlin, Jason Hunter, Fred Trimble
Version: 1.0

Constructor Summary
SAXOutputter(ContentHandler contentHandler)
           This will create a SAXOutputter with the specified ContentHandler.
SAXOutputter(ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver)
           This will create a SAXOutputter with the specified SAX2 handlers.

Method Summary
 voidoutput(Document document)
           This will output the JDOM Document, firing off the SAX events that have been registered.
 voidsetContentHandler(ContentHandler contentHandler)
           This will set the ContentHandler.
 voidsetDTDHandler(DTDHandler dtdHandler)
           This will set the DTDHandler.
 voidsetEntityResolver(EntityResolver entityResolver)
           This will set the EntityResolver.
 voidsetErrorHandler(ErrorHandler errorHandler)
           This will set the ErrorHandler.

Constructor Detail

SAXOutputter

public SAXOutputter(ContentHandler contentHandler)

This will create a SAXOutputter with the specified ContentHandler.

Parameters:
contentHandler - contains ContentHandler callback methods

SAXOutputter

public SAXOutputter(ContentHandler contentHandler, ErrorHandler errorHandler, DTDHandler dtdHandler, EntityResolver entityResolver)

This will create a SAXOutputter with the specified SAX2 handlers. At this time, only ContentHandler and EntityResolver are supported.

Parameters:
contentHandler - contains ContentHandler callback methods
errorHandler - contains ErrorHandler callback methods
dtdHandler - contains DTDHandler callback methods
entityResolver - contains EntityResolver callback methods
Method Detail

output

public void output(Document document)
throws org.jdom.JDOMException

This will output the JDOM Document, firing off the SAX events that have been registered.

Parameters:
document - JDOM Document to output.

setContentHandler

public void setContentHandler(ContentHandler contentHandler)

This will set the ContentHandler.

Parameters:
contentHandler - contains ContentHandler callback methods.

setDTDHandler

public void setDTDHandler(DTDHandler dtdHandler)

This will set the DTDHandler.

Parameters:
dtdHandler - contains DTDHandler callback methods.

setEntityResolver

public void setEntityResolver(EntityResolver entityResolver)

This will set the EntityResolver.

Parameters:
entityResolver - contains EntityResolver callback methods.

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)

This will set the ErrorHandler.

Parameters:
errorHandler - contains ErrorHandler callback methods.