net.sf.saxon.event
Class Builder
java.lang.Object
net.sf.saxon.event.Builder
- Receiver, Result
public abstract class Builder
extends java.lang.Object
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.
Builder() - create a Builder and initialise variables
|
LINKED_TREE
public static final int LINKED_TREE
Constant denoting the "linked tree" in which each node is represented as an object
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
TINY_TREE
public static final int TINY_TREE
Constant denoting the "tiny tree" in which the tree is represented internally using arrays of integers
UNSPECIFIED_TREE_MODEL
public static final int UNSPECIFIED_TREE_MODEL
Constant denoting a request for the default tree model
baseURI
protected String baseURI
currentRoot
protected NodeInfo currentRoot
lineNumbering
protected boolean lineNumbering
started
protected boolean started
systemId
protected String systemId
timing
protected boolean timing
Builder
public Builder()
create a Builder and initialise variables
build
public static NodeInfo build(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.
The preferred way to construct a document tree from a Source object is to
use the method Configuration.buildDocument(Source)
.
source
- Any javax.xml.transform.Source objectstripper
- A stripper object, if whitespace text nodes are to be stripped;
otherwise null.config
- The Configuration object
- the NodeInfo of the start node in the resulting document object.
build
public static NodeInfo build(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.
The preferred way to construct a document tree from a Source object is to
use the method Configuration.buildDocument(Source)
.
source
- Any javax.xml.transform.Source objectstripper
- A stripper object, if whitespace text nodes are to be stripped;
otherwise null.pipe
- The PipelineConfiguration object
- the NodeInfo of the start node in the resulting document object.
getBaseURI
public String getBaseURI()
Get the base URI of the document node of the tree being constructed by this builder
getConfiguration
public Configuration getConfiguration()
Get the Configuration
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.
- the root of the tree that is currently being built, or that has been most recently built
using this builder
getSystemId
public String getSystemId()
The SystemId is equivalent to the document-uri property defined in the XDM data model.
It should be set only in the case of a document that is potentially retrievable via this URI.
This means the value will be null in the case of a temporary tree constructed in the course of
executing a query or transformation.
- the SystemId, that is, the document-uri.
isTiming
public boolean isTiming()
Get timing option
- true if timing information has been requested
setBaseURI
public void setBaseURI(String baseURI)
Set the base URI of the document node of the tree being constructed by this builder
setLineNumbering
public void setLineNumbering(boolean lineNumbering)
Set line numbering on or off
lineNumbering
- set to true if line numbers are to be maintained for nodes in the tree being
constructed.
setSystemId
public void setSystemId(String systemId)
The SystemId is equivalent to the document-uri property defined in the XDM data model.
It should be set only in the case of a document that is potentially retrievable via this URI.
This means it should not be set in the case of a temporary tree constructed in the course of
executing a query or transformation.
- setSystemId in interface Receiver
systemId
- the SystemId, that is, the document-uri.
setTiming
public void setTiming(boolean on)
Set timing option on or off
on
- set to true to turn timing on. This causes the builder to display statistical information
about the tree that is constructed. It corresponds to the command line -t option
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
- startDocument in interface Receiver