net.sf.saxon.tinytree

Class TinyBuilder

public class TinyBuilder extends Builder

The TinyBuilder class is responsible for taking a stream of SAX events and constructing a Document tree, using the "TinyTree" implementation.

Author: Michael H. Kay

Field Summary
static intPARENT_POINTER_INTERVAL
Constructor Summary
TinyBuilder()
Create a TinyTree builder
Method Summary
voidattribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)
voidcharacters(CharSequence chars, int locationId, int properties)
Callback interface for SAX: not for application use
voidclose()
voidcomment(CharSequence chars, int locationId, int properties)
Callback interface for SAX: not for application use
voidendDocument()
Callback interface for SAX: not for application use
voidendElement()
Callback interface for SAX: not for application use
intgetCurrentDepth()
Get the current depth in the tree
NodeInfogetLastCompletedElement()
Get the last completed element node.
int[]getSizeParameters()
Get the size parameters for the tree
TinyTreegetTree()
Get the tree being built by this builder
protected intmakeTextNode(CharSequence chars, int len)
Create a text node.
voidnamespace(int namespaceCode, int properties)
voidopen()
Open the event stream
voidprocessingInstruction(String piname, CharSequence remainder, int locationId, int properties)
Callback interface for SAX: not for application use
voidreset()
voidsetSizeParameters(int[] params)
Set the size parameters for the tree
voidsetUnparsedEntity(String name, String uri, String publicId)
Set an unparsed entity in the document
voidstartContent()
voidstartDocument(int properties)
Write a document node to the tree
voidstartElement(int nameCode, int typeCode, int locationId, int properties)
Notify the start tag of an element

Field Detail

PARENT_POINTER_INTERVAL

public static final int PARENT_POINTER_INTERVAL

Constructor Detail

TinyBuilder

public TinyBuilder()
Create a TinyTree builder

Method Detail

attribute

public void attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties)

characters

public void characters(CharSequence chars, int locationId, int properties)
Callback interface for SAX: not for application use

close

public void close()

comment

public void comment(CharSequence chars, int locationId, int properties)
Callback interface for SAX: not for application use

endDocument

public void endDocument()
Callback interface for SAX: not for application use

endElement

public void endElement()
Callback interface for SAX: not for application use

getCurrentDepth

public int getCurrentDepth()
Get the current depth in the tree

Returns: the current depth

getLastCompletedElement

public NodeInfo getLastCompletedElement()
Get the last completed element node. This is used during checking of schema assertions, which happens while the tree is still under construction. This method is called immediately after a call on endElement(), and it returns the element that has just ended.

Returns: the last completed element node, that is, the element whose endElement event is the most recent endElement event to be reported

getSizeParameters

public int[] getSizeParameters()
Get the size parameters for the tree

Returns: an array of four integers giving the actual number of non-attribute nodes, the actual number of attributes, the actual number of namespace declarations, and the actual total length of character data

getTree

public TinyTree getTree()
Get the tree being built by this builder

Returns: the TinyTree

makeTextNode

protected int makeTextNode(CharSequence chars, int len)
Create a text node. Separate method so it can be overridden

Parameters: chars the contents of the text node len the length of the text node

namespace

public void namespace(int namespaceCode, int properties)

open

public void open()
Open the event stream

processingInstruction

public void processingInstruction(String piname, CharSequence remainder, int locationId, int properties)
Callback interface for SAX: not for application use

reset

public void reset()

setSizeParameters

public void setSizeParameters(int[] params)
Set the size parameters for the tree

Parameters: params an array of four integers giving the expected number of non-attribute nodes, the expected number of attributes, the expected number of namespace declarations, and the expected total length of character data

setUnparsedEntity

public void setUnparsedEntity(String name, String uri, String publicId)
Set an unparsed entity in the document

startContent

public void startContent()

startDocument

public void startDocument(int properties)
Write a document node to the tree

startElement

public void startElement(int nameCode, int typeCode, int locationId, int properties)
Notify the start tag of an element