Package net.sf.saxon.event
Class Builder
java.lang.Object
net.sf.saxon.event.Builder
- Direct Known Subclasses:
- AxiomWriter,- DOM4JWriter,- DOMWriter,- JDOM2Writer,- LinkedTreeBuilder,- TinyBuilder,- XOMWriter
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 SummaryFieldsModifier and TypeFieldDescriptionstatic final intprotected Stringprotected Configurationprotected NodeInfostatic final intprotected Durabilitystatic final intstatic final intprotected booleanstatic final intConstant denoting the "linked tree" in which each node is represented as an objectstatic final intConstant denoting the "mutable linked tree" in which each node is represented as an objectprotected NamePoolprotected booleanprotected PipelineConfigurationprotected booleanprotected Stringprotected booleanstatic final intConstant denoting the "tiny tree" in which the tree is represented internally using arrays of integersstatic final intConstant denoting the "tiny tree condensed", a variant of the tiny tree in which text and attribute nodes sharing the same string value use shared storage for the value.protected booleanstatic final intConstant denoting a request for the default tree modelprotected booleanFields inherited from interface javax.xml.transform.ResultPI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
- 
Constructor SummaryConstructorsConstructorDescriptionBuilder()Create a Builder and initialise variablesBuilder(PipelineConfiguration pipe) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Notify the end of the event streamGet the base URI of the document node of the tree being constructed by this builderGet a builder monitor for this builder.Get the ConfigurationGet 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 optionbooleanAsk whether the system IDs of constructed nodes (especially element nodes) are to be taken from the system ID property of theLocationobject passed as a parameter to theOutputter.startElement(NodeName, SchemaType, Location, int)event.voidopen()Notify the start of the event streamvoidreset()Reset the builder to its initial state.voidsetBaseURI(String baseURI) Set the base URI of the document node of the tree being constructed by this buildervoidsetDurability(Durability durability) voidsetLineNumbering(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 offvoidsetUseEventLocation(boolean useEventLocation) Say that the system IDs of constructed nodes (especially element nodes) are to be taken from the system ID property of theLocationobject passed as a parameter to theOutputter.startElement(NodeName, SchemaType, Location, int)event.booleanAsk whether this Receiver (or the downstream pipeline) makes any use of the type annotations supplied on element and attribute eventsMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.event.Receiverappend, append, characters, comment, endDocument, endElement, handlesAppend, processingInstruction, setUnparsedEntity, startDocument, startElement
- 
Field Details- 
UNSPECIFIED_TREE_MODELpublic static final int UNSPECIFIED_TREE_MODELConstant denoting a request for the default tree model- See Also:
 
- 
LINKED_TREEpublic static final int LINKED_TREEConstant denoting the "linked tree" in which each node is represented as an object- See Also:
 
- 
TINY_TREEpublic static final int TINY_TREEConstant denoting the "tiny tree" in which the tree is represented internally using arrays of integers- See Also:
 
- 
TINY_TREE_CONDENSEDpublic static final int TINY_TREE_CONDENSEDConstant denoting the "tiny tree condensed", a variant of the tiny tree in which text and attribute nodes sharing the same string value use shared storage for the value.- See Also:
 
- 
JDOM_TREEpublic static final int JDOM_TREE- See Also:
 
- 
JDOM2_TREEpublic static final int JDOM2_TREE- See Also:
 
- 
AXIOM_TREEpublic static final int AXIOM_TREE- See Also:
 
- 
DOMINO_TREEpublic static final int DOMINO_TREE- See Also:
 
- 
MUTABLE_LINKED_TREEpublic static final int MUTABLE_LINKED_TREEConstant denoting the "mutable linked tree" in which each node is represented as an object- See Also:
 
- 
pipe
- 
config
- 
namePool
- 
systemId
- 
baseURI
- 
uniformBaseURIprotected boolean uniformBaseURI
- 
currentRoot
- 
lineNumberingprotected boolean lineNumbering
- 
useEventLocationprotected boolean useEventLocation
- 
durability
- 
startedprotected boolean started
- 
timingprotected boolean timing
- 
openedprotected boolean opened
 
- 
- 
Constructor Details- 
Builderpublic Builder()Create a Builder and initialise variables
- 
Builder
 
- 
- 
Method Details- 
setPipelineConfigurationDescription copied from interface:ReceiverSet the pipeline configuration- Specified by:
- setPipelineConfigurationin interface- Receiver
- Parameters:
- pipe- the pipeline configuration
 
- 
getPipelineConfigurationDescription copied from interface:ReceiverGet the pipeline configuration- Specified by:
- getPipelineConfigurationin interface- Receiver
- Returns:
- the pipeline configuration
 
- 
getConfigurationGet the Configuration- Returns:
- the Saxon configuration
 
- 
getBuilderMonitorGet a builder monitor for this builder. This must be called immediately after opening the builder, and all events to the builder must thenceforth be sent via the BuilderMonitor.- Returns:
- a new BuilderMonitor appropriate to this kind of Builder; or null if the Builder does not provide this service. The default implementation returns null.
 
- 
setUseEventLocationpublic void setUseEventLocation(boolean useEventLocation) Say that the system IDs of constructed nodes (especially element nodes) are to be taken from the system ID property of theLocationobject passed as a parameter to theOutputter.startElement(NodeName, SchemaType, Location, int)event. This property should be set to true when building a document from events originating with an XML parser, because theLocationobject in this case will have a system ID that changes as external entities are processed. The base URI of a node in this case is determined by the system ID, modified by anyxml:baseattributes. If the property is set to false, all nodes in the tree have the same system ID, this being supplied as the systemID property of the builder. This will typically be the static base URI of the instruction in the query or stylesheet that was used to construct the root node; in the case ofxsl:result-document, it will be the absolutized value of thehrefattribute of the instruction.- Parameters:
- useEventLocation- true if the system ID is to be taken from the Location parameter of each event. The default value is true.
 
- 
isUseEventLocationpublic boolean isUseEventLocation()Ask whether the system IDs of constructed nodes (especially element nodes) are to be taken from the system ID property of theLocationobject passed as a parameter to theOutputter.startElement(NodeName, SchemaType, Location, int)event.- Returns:
- true if the system ID is to be taken from the Location parameter of each event. The default value is true.
 
- 
setSystemIdThe 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 interface- Result
- Parameters:
- systemId- the SystemId, that is, the document-uri.
 
- 
getSystemIdThe 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 interface- Result
- Returns:
- the SystemId, that is, the document-uri.
 
- 
setBaseURISet the base URI of the document node of the tree being constructed by this builder- Parameters:
- baseURI- the base URI
 
- 
getBaseURIGet the base URI of the document node of the tree being constructed by this builder- Returns:
- the base URI
 
- 
setDurability
- 
getDurability
- 
setLineNumberingpublic 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.
 
- 
setTimingpublic void setTiming(boolean on) Set timing option on or off- Parameters:
- 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
 
- 
isTimingpublic boolean isTiming()Get timing option- Returns:
- true if timing information has been requested
 
- 
openpublic void open()Description copied from interface:ReceiverNotify the start of the event stream
- 
closeDescription copied from interface:ReceiverNotify the end of the event stream- Specified by:
- closein interface- Receiver
- Throws:
- XPathException- if an error occurs
 
- 
usesTypeAnnotationspublic boolean usesTypeAnnotations()Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations supplied on element and attribute events- Specified by:
- usesTypeAnnotationsin interface- Receiver
- Returns:
- true if the Receiver makes any use of this information. If false, the caller may supply untyped nodes instead of supplying the type annotation
 
- 
getCurrentRootGet 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
 
- 
resetpublic void reset()Reset the builder to its initial state. The most important effect of calling this method (implemented in subclasses) is to release any links to the constructed document tree, allowing the memory occupied by the tree to released by the garbage collector even if the Builder is still in memory. This can happen because the Builder is referenced from a parser in the Configuration's parser pool.
 
-