net.sf.saxon.tinytree

Class WhitespaceTextImpl

Implemented Interfaces:
ExtendedNodeInfo, FingerprintedNode, Item, NodeInfo, Source, PullEvent, Source, SourceLocator, ValueRepresentation

public final class WhitespaceTextImpl
extends TinyNodeImpl

A node in the XML parse tree representing a text node with compressed whitespace content
Author:
Michael H. Kay

Field Summary

Fields inherited from class net.sf.saxon.tinytree.TinyNodeImpl

NODE_LETTER, nodeNr, parent, tree

Fields inherited from interface net.sf.saxon.om.NodeInfo

ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES

Fields inherited from interface net.sf.saxon.om.ValueRepresentation

EMPTY_VALUE_ARRAY

Constructor Summary

WhitespaceTextImpl(TinyTree tree, int nodeNr)
Create a compressed whitespace text node

Method Summary

static void
appendStringValue(TinyTree tree, int nodeNr, FastStringBuffer buffer)
Static method to get the string value of a text node and append it to a supplied buffer without first constructing the node object
void
copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter
static long
getLongValue(TinyTree tree, int nodeNr)
Static method to get the "long" value representing the content of a whitespace text node
int
getNodeKind()
Return the type of node.
String
getStringValue()
Return the character value of the node.
static CharSequence
getStringValue(TinyTree tree, int nodeNr)
Static method to get the string value of a text node without first constructing the node object
CharSequence
getStringValueCS()
Get the value of the item as a CharSequence.

Methods inherited from class net.sf.saxon.tinytree.TinyNodeImpl

atomize, compareOrder, equals, generateId, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getLineNumber, getLocalPart, getNameCode, getNamePool, getNodeNumber, getParent, getPrefix, getPublicId, getRoot, getSequenceNumber, getStringValueCS, getSystemId, getTypeAnnotation, getTypedValue, getURI, hasChildNodes, hashCode, isAncestorOrSelf, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis, setParentNode, setSystemId

Constructor Details

WhitespaceTextImpl

public WhitespaceTextImpl(TinyTree tree,
                          int nodeNr)
Create a compressed whitespace text node
Parameters:
tree - the tree to contain the node
nodeNr - the internal node number

Method Details

appendStringValue

public static void appendStringValue(TinyTree tree,
                                     int nodeNr,
                                     FastStringBuffer buffer)
Static method to get the string value of a text node and append it to a supplied buffer without first constructing the node object
Parameters:
tree - the tree
nodeNr - the node number of the text node
buffer - a buffer to which the string value will be appended

copy

public void copy(Receiver out,
                 int whichNamespaces,
                 boolean copyAnnotations,
                 int locationId)
            throws XPathException
Copy this node to a given outputter
Specified by:
copy in interface NodeInfo

getLongValue

public static long getLongValue(TinyTree tree,
                                int nodeNr)
Static method to get the "long" value representing the content of a whitespace text node
Parameters:
tree - the TinyTree
nodeNr - the internal node number
Returns:
a value representing the compressed whitespace content

getNodeKind

public final int getNodeKind()
Return the type of node.
Specified by:
getNodeKind in interface NodeInfo
Returns:
Type.TEXT

getStringValue

public String getStringValue()
Return the character value of the node.
Specified by:
getStringValue in interface NodeInfo
getStringValue in interface Item
getStringValue in interface ValueRepresentation
Returns:
the string value of the node

getStringValue

public static CharSequence getStringValue(TinyTree tree,
                                          int nodeNr)
Static method to get the string value of a text node without first constructing the node object
Parameters:
tree - the tree
nodeNr - the node number of the text node
Returns:
the string value of the text node

getStringValueCS

public CharSequence getStringValueCS()
Get the value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String. For a WhitespaceTextImpl node, it avoids the cost of decompressing the whitespace
Specified by:
getStringValueCS in interface Item
getStringValueCS in interface ValueRepresentation
Overrides:
getStringValueCS in interface TinyNodeImpl