Class Builder
java.lang.Object
net.sf.saxon.event.Builder
- Direct Known Subclasses:
TinyBuilder, TreeBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Configurationprotected NodeInfoprotected booleanstatic final intConstant denoting the "linked tree" in which each node is represented as an objectprotected NamePoolprotected PipelineConfigurationstatic final intAlternative constant denoting the "linked tree" in which each node is represented as an object Retained for backwards compatibilityprotected booleanprotected Stringprotected booleanstatic final intConstant denoting the "tiny tree" in which the tree is represented internally using arrays of integersFields inherited from interface Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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()Notify the end of the event streamvoidNotify the end of a document nodeGet the base URI of the document node of the tree being constructed by this builderGet the current root node.Get the pipeline configurationThe SystemId is equivalent to the document-uri property defined in the XDM data model.booleanisTiming()Get timing optionvoidopen()Notify the start of the event streamvoidsetBaseURI(String baseURI) Set the base URI of the document node of the tree being constructed by this buildervoidsetLineNumbering(boolean lineNumbering) Set line numbering on or offvoidSet the pipeline configurationvoidsetSystemId(String systemId) The SystemId is equivalent to the document-uri property defined in the XDM data model.voidsetTiming(boolean on) Set timing option on or offvoidstartDocument(int properties) Start of a document node.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Receiver
attribute, characters, comment, endElement, namespace, processingInstruction, setUnparsedEntity, startContent, startElement
-
Field Details
-
LINKED_TREE
public static final int LINKED_TREEConstant denoting the "linked tree" in which each node is represented as an object- See Also:
-
STANDARD_TREE
public static final int STANDARD_TREEAlternative constant denoting the "linked tree" in which each node is represented as an object Retained for backwards compatibility- See Also:
-
TINY_TREE
public static final int TINY_TREEConstant denoting the "tiny tree" in which the tree is represented internally using arrays of integers- See Also:
-
pipe
-
config
-
namePool
-
systemId
-
baseURI
-
currentRoot
-
lineNumbering
protected boolean lineNumbering -
started
protected boolean started -
timing
protected boolean timing
-
-
Constructor Details
-
Builder
public Builder()create a Builder and initialise variables
-
-
Method Details
-
setPipelineConfiguration
Description copied from interface:ReceiverSet the pipeline configuration- Specified by:
setPipelineConfigurationin interfaceReceiver
-
getPipelineConfiguration
Description copied from interface:ReceiverGet the pipeline configuration- Specified by:
getPipelineConfigurationin interfaceReceiver
-
getConfiguration
-
setSystemId
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.- Specified by:
setSystemIdin interfaceReceiver- Specified by:
setSystemIdin interfaceResult- Parameters:
systemId- the SystemId, that is, the document-uri.
-
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.- Specified by:
getSystemIdin interfaceResult- Returns:
- the SystemId, that is, the document-uri.
-
setBaseURI
Set the base URI of the document node of the tree being constructed by this builder- Parameters:
baseURI- the base URI
-
getBaseURI
Get the base URI of the document node of the tree being constructed by this builder- Returns:
- the base URI
-
setLineNumbering
public void setLineNumbering(boolean lineNumbering) Set line numbering on or off- Parameters:
lineNumbering- set to true if line numbers are to be maintained for nodes in the tree being constructed.
-
setTiming
public void setTiming(boolean on) Set timing option on or off -
isTiming
public boolean isTiming()Get timing option -
open
Description copied from interface:ReceiverNotify the start of the event stream- Specified by:
openin interfaceReceiver- Throws:
XPathException
-
close
Description copied from interface:ReceiverNotify the end of the event stream- Specified by:
closein interfaceReceiver- Throws:
XPathException
-
startDocument
Start of a document node. This event is ignored: we simply add the contained elements to the current document- Specified by:
startDocumentin interfaceReceiver- Throws:
XPathException
-
endDocument
Notify the end of a document node- Specified by:
endDocumentin interfaceReceiver- Throws:
XPathException
-
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(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 objectstripper- 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(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 objectstripper- 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
-