org.jdom.output
Class SAXOutputter

java.lang.Object
  |
  +--org.jdom.output.SAXOutputter

public class SAXOutputter
extends Object

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.

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

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
 void output(Document document)
           This will output the JDOM Document, firing off the SAX events that have been registered.
 void setContentHandler(ContentHandler contentHandler)
           This will set the ContentHandler.
 void setDTDHandler(DTDHandler dtdHandler)
           This will set the DTDHandler.
 void setEntityResolver(EntityResolver entityResolver)
           This will set the EntityResolver.
 void setErrorHandler(ErrorHandler errorHandler)
           This will set the ErrorHandler.
 void setReportNamespaceDeclarations(boolean declareNamespaces)
           This will define whether attribute namespace declarations shall be reported as "xmlns" attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

setContentHandler

public void setContentHandler(ContentHandler contentHandler)

This will set the ContentHandler.

Parameters:
contentHandler - contains ContentHandler callback methods.

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)

This will set the ErrorHandler.

Parameters:
errorHandler - contains ErrorHandler 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.

setReportNamespaceDeclarations

public void setReportNamespaceDeclarations(boolean declareNamespaces)

This will define whether attribute namespace declarations shall be reported as "xmlns" attributes. This flag defaults to false and behaves as the "namespace-prefixes" SAX core feature.

Parameters:
reportDecl - whether attribute namespace declarations shall be reported as "xmlns" attributes.

output

public void output(Document document)
            throws JDOMException

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

Parameters:
document - JDOM Document to output.


Copyright © 2001 Jason Hunter, Brett McLaughlin. All Rights Reserved.