net.sf.saxon.event
Class Builder

java.lang.Object
  extended bynet.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  NodeInfo currentRoot
           
protected  boolean lineNumbering
           
static int LINKED_TREE
          Constant denoting the "linked tree" in which each node is represented as an object
protected  NamePool namePool
           
protected  PipelineConfiguration pipe
           
static int STANDARD_TREE
          Alternative constant denoting the "linked tree" in which each node is represented as an object Retained for backwards compatibility
protected  boolean started
           
protected  java.lang.String systemId
           
protected  boolean timing
           
static int TINY_TREE
          Constant denoting the "tiny tree" in which the tree is represented internally using arrays of integers
 
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.
static NodeInfo build(javax.xml.transform.Source source, Stripper stripper, PipelineConfiguration pipe)
          Static method to build a document from any kind of Source object.
 void close()
          Notify the end of the event stream
 void endDocument()
          Notify the end of a document node
 Configuration getConfiguration()
           
 NodeInfo getCurrentRoot()
          Get the current root node.
 PipelineConfiguration getPipelineConfiguration()
          Get the pipeline configuration
 java.lang.String getSystemId()
           
 boolean isTiming()
          Get timing option
 void open()
          Notify the start of the event stream
 void setLineNumbering(boolean is)
           
 void setPipelineConfiguration(PipelineConfiguration pipe)
          Set the pipeline configuration
 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(int properties)
          Start of a document node.
 
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

LINKED_TREE

public static final int LINKED_TREE
Constant denoting the "linked tree" in which each node is represented as an object

See Also:
Constant Field Values

STANDARD_TREE

public static final int STANDARD_TREE
Alternative constant denoting the "linked tree" in which each node is represented as an object Retained for backwards compatibility

See Also:
Constant Field Values

TINY_TREE

public static final int TINY_TREE
Constant denoting the "tiny tree" in which the tree is represented internally using arrays of integers

See Also:
Constant Field Values

pipe

protected PipelineConfiguration pipe

config

protected Configuration config

namePool

protected NamePool namePool

systemId

protected java.lang.String systemId

currentRoot

protected NodeInfo currentRoot

lineNumbering

protected boolean lineNumbering

started

protected boolean started

timing

protected boolean timing
Constructor Detail

Builder

public Builder()
create a Builder and initialise variables

Method Detail

setPipelineConfiguration

public void setPipelineConfiguration(PipelineConfiguration pipe)
Description copied from interface: Receiver
Set the pipeline configuration

Specified by:
setPipelineConfiguration in interface Receiver

getPipelineConfiguration

public PipelineConfiguration getPipelineConfiguration()
Description copied from interface: Receiver
Get the pipeline configuration

Specified by:
getPipelineConfiguration in interface Receiver

getConfiguration

public Configuration getConfiguration()

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

setLineNumbering

public void setLineNumbering(boolean is)

setTiming

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


isTiming

public boolean isTiming()
Get timing option


open

public void open()
          throws XPathException
Description copied from interface: Receiver
Notify the start of the event stream

Specified by:
open in interface Receiver
Throws:
XPathException

close

public void close()
           throws XPathException
Description copied from interface: Receiver
Notify the end of the event stream

Specified by:
close in interface Receiver
Throws:
XPathException

startDocument

public void startDocument(int properties)
                   throws XPathException
Start of a document node. This event is ignored: we simply add the contained elements to the current document

Specified by:
startDocument in interface Receiver
Throws:
XPathException

endDocument

public void endDocument()
                 throws XPathException
Notify the end of a document node

Specified by:
endDocument in interface Receiver
Throws:
XPathException

getCurrentRoot

public NodeInfo getCurrentRoot()
Get the current root node. This will normally be a document node, but if the root of the tree is an element node, it can be an element.

Returns:
the root of the tree that is currently being built, or 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.
Throws:
XPathException

build

public static NodeInfo build(javax.xml.transform.Source source,
                             Stripper stripper,
                             PipelineConfiguration pipe)
                      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.
pipe - The PipelineConfiguration object
Returns:
the NodeInfo of the start node in the resulting document object.
Throws:
XPathException