org.apache.fop.fo

Class FOTreeBuilder


public class FOTreeBuilder
extends DefaultHandler

SAX Handler that passes parsed data to the various FO objects, where they can be used either to build an FO Tree, or used by Structure Renderers to build other data structures.

Field Summary

protected ContentHandler
delegate
Current delegate ContentHandler to receive the SAX events
protected ElementMappingRegistry
elementMappingRegistry
The registry for ElementMapping instances
protected Log
log
logging instance
protected org.apache.fop.fo.FOTreeBuilder.MainFOHandler
mainFOHandler
Main DefaultHandler that handles the FO namespace.
protected Root
rootFObj
The root of the formatting object tree

Constructor Summary

FOTreeBuilder(String outputFormat, FOUserAgent foUserAgent, OutputStream stream)
FOTreeBuilder constructor

Method Summary

void
characters(char[] data, int start, int length)
SAX Handler for characters
void
endDocument()
SAX Handler for the end of the document
void
endElement(String uri, String localName, String rawName)
SAX Handler for the end of an element
void
error(SAXParseException e)
void
fatalError(SAXParseException e)
protected Locator
getEffectiveLocator()
FOEventHandler
getEventHandler()
Provides access to the underlying FOEventHandler object.
FormattingResults
getResults()
Returns the results of the rendering process.
protected boolean
isLocatorDisabled()
Deprecated. Use FOUserAgent.isLocatorEnabled() instead.
void
setDocumentLocator(Locator locator)
SAX Handler for locator
void
startDocument()
SAX Handler for the start of the document
void
startElement(String namespaceURI, String localName, String rawName, Attributes attlist)
SAX Handler for the start of an element
void
warning(SAXParseException e)

Field Details

delegate

protected ContentHandler delegate
Current delegate ContentHandler to receive the SAX events

elementMappingRegistry

protected ElementMappingRegistry elementMappingRegistry
The registry for ElementMapping instances

log

protected Log log
logging instance

mainFOHandler

protected org.apache.fop.fo.FOTreeBuilder.MainFOHandler mainFOHandler
Main DefaultHandler that handles the FO namespace.

rootFObj

protected Root rootFObj
The root of the formatting object tree

Constructor Details

FOTreeBuilder

public FOTreeBuilder(String outputFormat,
                     FOUserAgent foUserAgent,
                     OutputStream stream)
            throws FOPException
FOTreeBuilder constructor
Parameters:
outputFormat - the MIME type of the output format to use (ex. "application/pdf").
foUserAgent - in effect for this process
stream - OutputStream to direct results
Throws:
FOPException - if the FOTreeBuilder cannot be properly created

Method Details

characters

public void characters(char[] data,
                       int start,
                       int length)
            throws SAXException
SAX Handler for characters
See Also:
org.xml.sax.ContentHandler.characters(char[], int, int)

endDocument

public void endDocument()
            throws SAXException
SAX Handler for the end of the document
See Also:
org.xml.sax.ContentHandler.endDocument()

endElement

public void endElement(String uri,
                       String localName,
                       String rawName)
            throws SAXException
SAX Handler for the end of an element
See Also:
org.xml.sax.ContentHandler.endElement(String, String, String)

error

public void error(SAXParseException e)
See Also:
org.xml.sax.ErrorHandler.error(org.xml.sax.SAXParseException)

fatalError

public void fatalError(SAXParseException e)
            throws SAXException
See Also:
org.xml.sax.ErrorHandler.fatalError(org.xml.sax.SAXParseException)

getEffectiveLocator

protected Locator getEffectiveLocator()
Returns:
a Locator instance if it is available and not disabled

getEventHandler

public FOEventHandler getEventHandler()
Provides access to the underlying FOEventHandler object.
Returns:
the FOEventHandler object

getResults

public FormattingResults getResults()
Returns the results of the rendering process. Information includes the total number of pages generated and the number of pages per page-sequence.
Returns:
the results of the rendering process.

isLocatorDisabled

protected boolean isLocatorDisabled()

Deprecated. Use FOUserAgent.isLocatorEnabled() instead.

This method enables to reduce memory consumption of the FO tree slightly. When it returns true no Locator is passed to the FO tree nodes which would copy the information into a SAX LocatorImpl instance.
Returns:
true if no context information should be stored on each node in the FO tree.

setDocumentLocator

public void setDocumentLocator(Locator locator)
SAX Handler for locator
See Also:
org.xml.sax.ContentHandler.setDocumentLocator(Locator)

startDocument

public void startDocument()
            throws SAXException
SAX Handler for the start of the document
See Also:
org.xml.sax.ContentHandler.startDocument()

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String rawName,
                         Attributes attlist)
            throws SAXException
SAX Handler for the start of an element
See Also:
org.xml.sax.ContentHandler.startElement(String, String, String, Attributes)

warning

public void warning(SAXParseException e)
See Also:
org.xml.sax.ErrorHandler.warning(org.xml.sax.SAXParseException)

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.