net.sf.saxon.event
Class Builder

java.lang.Object
  |
  +--net.sf.saxon.event.Builder
All Implemented Interfaces:
Receiver, javax.xml.transform.Result
Direct Known Subclasses:
TinyBuilder, TreeBuilder

public abstract class Builder
extends java.lang.Object
implements Receiver

The abstract Builder class is responsible for taking a stream of SAX events and constructing a Document tree. There is one concrete subclass for each tree implementation.


Field Summary
protected  Configuration config
           
protected  DocumentInfo currentDocument
           
protected  boolean lineNumbering
           
protected  org.xml.sax.Locator locator
           
protected  NamePool namePool
           
static int STANDARD_TREE
           
protected  boolean started
           
protected  java.lang.String systemId
           
protected  boolean timing
           
static int TINY_TREE
           
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
Builder()
          create a Builder and initialise variables
 
Method Summary
static NodeInfo build(javax.xml.transform.Source source, Stripper stripper, Configuration config)
          Static method to build a document from any kind of Source object.
 void endDocument()
          Notify the end of the document
 Configuration getConfiguration()
          Get the configuration
 DocumentInfo getCurrentDocument()
          Get the current document
 java.lang.String getSystemId()
           
 boolean isTiming()
          Get timing option
 void setConfiguration(Configuration config)
          Set the configuration
 void setDocumentLocator(org.xml.sax.Locator loc)
          Set locator, to identify position in the document.
 void setLineNumbering(boolean onOrOff)
          Set line numbering on or off
 void setRootNode(DocumentInfo doc)
          Set the root (document) node to use.
 void setSystemId(java.lang.String systemId)
          Set the System ID of the destination tree
 void setTiming(boolean on)
          Set timing option on or off
 void startDocument()
          Set output for error messages produced by the default error handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.saxon.event.Receiver
attribute, characters, comment, endElement, namespace, processingInstruction, setUnparsedEntity, startContent, startElement
 

Field Detail

STANDARD_TREE

public static final int STANDARD_TREE
See Also:
Constant Field Values

TINY_TREE

public static final int TINY_TREE
See Also:
Constant Field Values

config

protected Configuration config

namePool

protected NamePool namePool

systemId

protected java.lang.String systemId

locator

protected org.xml.sax.Locator locator

currentDocument

protected DocumentInfo currentDocument

started

protected boolean started

timing

protected boolean timing

lineNumbering

protected boolean lineNumbering
Constructor Detail

Builder

public Builder()
create a Builder and initialise variables

Method Detail

setConfiguration

public void setConfiguration(Configuration config)
Description copied from interface: Receiver
Set the configuration

Specified by:
setConfiguration in interface Receiver

getConfiguration

public Configuration getConfiguration()
Description copied from interface: Receiver
Get the configuration

Specified by:
getConfiguration in interface Receiver

setSystemId

public void setSystemId(java.lang.String systemId)
Description copied from interface: Receiver
Set the System ID of the destination tree

Specified by:
setSystemId in interface Receiver

getSystemId

public java.lang.String getSystemId()
Specified by:
getSystemId in interface javax.xml.transform.Result

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator loc)
Description copied from interface: Receiver
Set locator, to identify position in the document. A new locator may be supplied at any time. It is not necessary to supply any locator. If a locator is supplied, it may be used by the Receiver to obtain information about the location of the current event in a source XML document.

Specified by:
setDocumentLocator in interface Receiver

setRootNode

public void setRootNode(DocumentInfo doc)
Set the root (document) node to use. This method is used to support the JAXP facility to attach transformation output to a supplied Document node. It must be called before startDocument(), and the type of document node must be compatible with the type of Builder used.


setTiming

public void setTiming(boolean on)
Set timing option on or off


isTiming

public boolean isTiming()
Get timing option


setLineNumbering

public void setLineNumbering(boolean onOrOff)
Set line numbering on or off


startDocument

public void startDocument()
                   throws javax.xml.transform.TransformerException
Set output for error messages produced by the default error handler. The default error handler does not throw an exception for parse errors or input I/O errors, rather it returns a result code and writes diagnostics to a user-specified output writer, which defaults to System.err
This call has no effect if setErrorHandler() has been called to supply a user-defined error handler

Specified by:
startDocument in interface Receiver
javax.xml.transform.TransformerException

endDocument

public void endDocument()
                 throws javax.xml.transform.TransformerException
Description copied from interface: Receiver
Notify the end of the document

Specified by:
endDocument in interface Receiver
javax.xml.transform.TransformerException

getCurrentDocument

public DocumentInfo getCurrentDocument()
Get the current document

Returns:
the document that has been most recently built using this builder

build

public static NodeInfo build(javax.xml.transform.Source source,
                             Stripper stripper,
                             Configuration config)
                      throws XPathException
Static method to build a document from any kind of Source object. If the source is already in the form of a tree, it is wrapped as required.

Parameters:
source - Any javax.xml.transform.Source object
stripper - A stripper object, if whitespace text nodes are to be stripped; otherwise null.
config - The Configuration object
Returns:
the NodeInfo of the start node in the resulting document object.
XPathException