net.sf.saxon.tree
Class TreeBuilder
public
class
TreeBuilder
extends Builder
The TreeBuilder class is responsible for taking a stream of Receiver events and constructing
a Document tree using the linked tree implementation.
Author: Michael H. Kay
Method Summary |
void | attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties) |
void | characters(CharSequence chars, int locationId, int properties)
Notify a text node. |
void | close()
Close the stream of Receiver events |
void | comment(CharSequence chars, int locationId, int properties)
Notify a comment |
void | endDocument()
Notify the end of the document |
void | endElement()
Notify the end of an element |
NodeInfo | getCurrentRoot()
Get the current root node. |
void | graftElement(ElementImpl element)
graftElement() allows an element node to be transferred from one tree to another.
|
void | namespace(int namespaceCode, int properties) |
void | open()
Open the stream of Receiver events |
void | processingInstruction(String name, CharSequence remainder, int locationId, int properties)
Notify a processing instruction |
void | reset() |
void | setAllocateSequenceNumbers(boolean allocate)
Set whether the builder should allocate sequence numbers to elements as they are added to the
tree. |
void | setNodeFactory(NodeFactory factory)
Set the Node Factory to use. |
void | setUnparsedEntity(String name, String uri, String publicId)
Set an unparsed entity URI for the document |
void | startContent() |
void | startDocument(int properties)
Start of a document node.
|
void | startElement(int nameCode, int typeCode, int locationId, int properties)
Notify the start of an element |
public TreeBuilder()
create a Builder and initialise variables
public void attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
public void characters(CharSequence chars, int locationId, int properties)
Notify a text node. Adjacent text nodes must have already been merged
public void close()
Close the stream of Receiver events
public void comment(CharSequence chars, int locationId, int properties)
Notify a comment
public void endDocument()
Notify the end of the document
public void endElement()
Notify the end of an element
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
graftElement() allows an element node to be transferred from one tree to another.
This is a dangerous internal interface which is used only to contruct a stylesheet
tree from a stylesheet using the "literal result element as stylesheet" syntax.
The supplied element is grafted onto the current element as its only child.
Parameters: element the element to be grafted in as a new child.
public void namespace(int namespaceCode, int properties)
public void open()
Open the stream of Receiver events
public void processingInstruction(String name, CharSequence remainder, int locationId, int properties)
Notify a processing instruction
public void reset()
public void setAllocateSequenceNumbers(boolean allocate)
Set whether the builder should allocate sequence numbers to elements as they are added to the
tree. This is normally done, because it provides a quick way of comparing document order. But
nodes added using XQuery update are not sequence-numbered.
Parameters: allocate true if sequence numbers are to be allocated
Set the Node Factory to use. If none is specified, the Builder uses its own.
Parameters: factory the node factory to be used. This allows custom objects to be used to represent
the elements in the tree.
public void setUnparsedEntity(String name, String uri, String publicId)
Set an unparsed entity URI for the document
public void startContent()
public void startDocument(int properties)
Start of a document node.
This event is ignored: we simply add the contained elements to the current document
public void startElement(int nameCode, int typeCode, int locationId, int properties)
Notify the start of an element