net.sf.saxon.event

Class Builder

public abstract class Builder extends 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.

Author: Michael H. Kay

Field Summary
protected Configurationconfig
protected NodeInfocurrentRoot
protected booleanlineNumbering
static intLINKED_TREE
Constant denoting the "linked tree" in which each node is represented as an object
protected NamePoolnamePool
protected PipelineConfigurationpipe
protected booleanstarted
protected StringsystemId
static intSTANDARD_TREE
Alternative constant denoting the "linked tree" in which each node is represented as an object Retained for backwards compatibility
protected booleantiming
static intTINY_TREE
Constant denoting the "tiny tree" in which the tree is represented internally using arrays of integers
Constructor Summary
Builder()
create a Builder and initialise variables
Method Summary
static NodeInfobuild(Source source, Stripper stripper, Configuration config)
Static method to build a document from any kind of Source object.
static NodeInfobuild(Source source, Stripper stripper, PipelineConfiguration pipe)
Static method to build a document from any kind of Source object.
voidclose()
voidendDocument()
Notify the end of a document node
ConfigurationgetConfiguration()
NodeInfogetCurrentRoot()
Get the current root node.
PipelineConfigurationgetPipelineConfiguration()
StringgetSystemId()
booleanisTiming()
Get timing option
voidopen()
voidsetLineNumbering(boolean is)
voidsetPipelineConfiguration(PipelineConfiguration pipe)
voidsetSystemId(String systemId)
voidsetTiming(boolean on)
Set timing option on or off
voidstartDocument(int properties)
Start of a document node.

Field Detail

config

protected Configuration config

currentRoot

protected NodeInfo currentRoot

lineNumbering

protected boolean lineNumbering

LINKED_TREE

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

namePool

protected NamePool namePool

pipe

protected PipelineConfiguration pipe

started

protected boolean started

systemId

protected String systemId

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

timing

protected boolean timing

TINY_TREE

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

Constructor Detail

Builder

public Builder()
create a Builder and initialise variables

Method Detail

build

public static NodeInfo build(Source source, Stripper stripper, Configuration config)
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.

build

public static NodeInfo build(Source source, Stripper stripper, PipelineConfiguration pipe)
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.

close

public void close()

endDocument

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

getConfiguration

public Configuration getConfiguration()

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

getPipelineConfiguration

public PipelineConfiguration getPipelineConfiguration()

getSystemId

public String getSystemId()

isTiming

public boolean isTiming()
Get timing option

open

public void open()

setLineNumbering

public void setLineNumbering(boolean is)

setPipelineConfiguration

public void setPipelineConfiguration(PipelineConfiguration pipe)

setSystemId

public void setSystemId(String systemId)

setTiming

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

startDocument

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