Package org.apache.fop.fo
Class FOTreeBuilder
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.fop.fo.FOTreeBuilder
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class FOTreeBuilder extends org.xml.sax.helpers.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
FOTreeBuilder.MainFOHandler
MainDefaultHandler
implementation which builds the FO tree.
-
Field Summary
Fields Modifier and Type Field Description private FOTreeBuilderContext
builderContext
Provides information used during tree building stage.protected org.xml.sax.ContentHandler
delegate
Current delegate ContentHandler to receive the SAX eventsprivate int
depth
protected ElementMappingRegistry
elementMappingRegistry
The registry for ElementMapping instancesprivate boolean
empty
private boolean
errorinstart
private FOEventHandler
foEventHandler
The object that handles formatting and rendering to a streamprivate org.xml.sax.Locator
locator
The SAX locator object managing the line and column countersprivate static org.apache.commons.logging.Log
LOG
logging instanceprotected FOTreeBuilder.MainFOHandler
mainFOHandler
Main DefaultHandler that handles the FO namespace.protected Root
rootFObj
The root of the formatting object treeprivate boolean
used
private FOUserAgent
userAgent
The user agent for this processing run.
-
Constructor Summary
Constructors Constructor Description FOTreeBuilder(java.lang.String outputFormat, FOUserAgent foUserAgent, java.io.OutputStream stream)
FOTreeBuilder
constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] data, int start, int length)
void
endDocument()
void
endElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName)
void
error(org.xml.sax.SAXParseException e)
void
fatalError(org.xml.sax.SAXParseException e)
protected org.xml.sax.Locator
getEffectiveLocator()
FOEventHandler
getEventHandler()
Provides access to the underlyingFOEventHandler
object.FormattingResults
getResults()
Returns the results of the rendering process.void
setDocumentLocator(org.xml.sax.Locator locator)
void
startDocument()
void
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attlist)
void
warning(org.xml.sax.SAXParseException e)
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
logging instance
-
elementMappingRegistry
protected ElementMappingRegistry elementMappingRegistry
The registry for ElementMapping instances
-
rootFObj
protected Root rootFObj
The root of the formatting object tree
-
mainFOHandler
protected FOTreeBuilder.MainFOHandler mainFOHandler
Main DefaultHandler that handles the FO namespace.
-
delegate
protected org.xml.sax.ContentHandler delegate
Current delegate ContentHandler to receive the SAX events
-
builderContext
private FOTreeBuilderContext builderContext
Provides information used during tree building stage.
-
foEventHandler
private FOEventHandler foEventHandler
The object that handles formatting and rendering to a stream
-
locator
private org.xml.sax.Locator locator
The SAX locator object managing the line and column counters
-
userAgent
private FOUserAgent userAgent
The user agent for this processing run.
-
used
private boolean used
-
empty
private boolean empty
-
depth
private int depth
-
errorinstart
private boolean errorinstart
-
-
Constructor Detail
-
FOTreeBuilder
public FOTreeBuilder(java.lang.String outputFormat, FOUserAgent foUserAgent, java.io.OutputStream stream) throws FOPException
FOTreeBuilder
constructor- Parameters:
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").foUserAgent
- theFOUserAgent
in effect for this processstream
- theOutputStream
to direct the results to- Throws:
FOPException
- if theFOTreeBuilder
cannot be properly created
-
-
Method Detail
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classorg.xml.sax.helpers.DefaultHandler
-
getEffectiveLocator
protected org.xml.sax.Locator getEffectiveLocator()
- Returns:
- a
Locator
instance if it is available and not disabled
-
characters
public void characters(char[] data, int start, int length) throws org.xml.sax.SAXException
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attlist) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
warning
public void warning(org.xml.sax.SAXParseException e)
- Specified by:
warning
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
warning
in classorg.xml.sax.helpers.DefaultHandler
-
error
public void error(org.xml.sax.SAXParseException e)
- Specified by:
error
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
error
in classorg.xml.sax.helpers.DefaultHandler
-
fatalError
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
- Specified by:
fatalError
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
fatalError
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
getEventHandler
public FOEventHandler getEventHandler()
Provides access to the underlyingFOEventHandler
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.
-
-