## net.sf.saxon.value
Class TextFragmentValue

    java.lang.Object
      |
      +--net.sf.saxon.om.AbstractNode
            |
            +--net.sf.saxon.value.TextFragmentValue

All Implemented Interfaces:
  DocumentInfo, javax.xml.transform.dom.DOMLocator, FingerprintedNode, Item, org.w3c.dom.Node, NodeInfo, javax.xml.transform.Source, javax.xml.transform.SourceLocator

public final class TextFragmentValue
extends AbstractNode
implements DocumentInfo

This class represents a temporary tree whose root document node owns a single text node.

Field Summary

Fields inherited from class net.sf.saxon.om.AbstractNode
`NODE_LETTER`

Fields inherited from interface net.sf.saxon.om.NodeInfo
`ALL_NAMESPACES, LOCAL_NAMESPACES, NO_NAMESPACES`

Fields inherited from interface org.w3c.dom.Node
`ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

Constructor Summary
`TextFragmentValue(java.lang.CharSequence value, java.lang.String systemId)` Constructor: create a result tree fragment containing a single text node

Method Summary
`int` `compareOrder(NodeInfo other)` Determine the relative position of this node and another node, in document order.
`void` `copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)` Copy the result tree fragment value to a given Outputter
`java.lang.String` `generateId()` Get a character string that uniquely identifies this node
`java.lang.String` `getAttributeValue(int fingerprint)` Get the value of a given attribute of this node
`java.lang.String` `getBaseURI()` Get the base URI for the node.
`Configuration` `getConfiguration()` Get the configuration previously set using setConfiguration (or the default configuraton allocated automatically)
`java.lang.String` `getDisplayName()` Get the display name of this node.
`int` `getDocumentNumber()` Get the unique document number
`DocumentInfo` `getDocumentRoot()` Get the root (document) node
`int` `getFingerprint()` Get the fingerprint of the node, used for matching names
`java.lang.String` `getLocalPart()` Get the local name of this node.
`int` `getNameCode()` Get the name code of the node, used for displaying names
`NamePool` `getNamePool()` Get the name pool used for the names in this document
`int` `getNodeKind()` Return the type of node.
`NodeInfo` `getParent()` Find the parent node of this node.
`java.lang.String` `getPrefix()` Get the prefix part of the name of this node.
`NodeInfo` `getRoot()` Get the root node
`java.lang.String` `getStringValue()` Get the String Value
`java.lang.String` `getSystemId()` Get the system ID for the entity containing the node.
`java.lang.String[]` `getUnparsedEntity(java.lang.String name)` Get the unparsed entity with a given name
`java.lang.String` `getURI()` Get the URI part of the name of this node.
`boolean` `hasAttributes()` Returns whether this node has any attributes.
`boolean` `hasChildNodes()` Determine whether the node has any children.
`boolean` `isSameNodeInfo(NodeInfo other)` Determine whether this is the same node as another node
`AxisIterator` `iterateAxis(byte axisNumber)` Return an iteration over the nodes reached by the given axis from this node
`AxisIterator` `iterateAxis(byte axisNumber, NodeTest nodeTest)` Return an enumeration over the nodes reached by the given axis from this node
`NodeInfo` `selectID(java.lang.String id)` Get the element with a given ID.
`void` `setConfiguration(Configuration config)` Set the configuration (containing the name pool used for all names in this document)
`void` `setSystemId(java.lang.String systemId)` Set the system ID for the entity containing the node.

Methods inherited from class net.sf.saxon.om.AbstractNode

`appendChild, appendData, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, disallowUpdate, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getChildNodes, getColumnNumber, getData, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getFirstChild, getImplementation, getLastChild, getLength, getLineNumber, getLocalName, getName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOriginatingNode, getOwnerDocument, getOwnerElement, getParentNode, getPreviousSibling, getPublicId, getSchemaTypeInfo, getSpecified, getTagName, getTextContent, getTypeAnnotation, getTypedValue, getUserData, getValue, hasAttribute, hasAttributeNS, importNode, insertBefore, insertData, isDefaultNamespace, isEqualNode, isId, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, outputNamespaceNodes, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setPrefix, setTextContent, setValue, splitText, substringData, supports`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface net.sf.saxon.om.NodeInfo
`getLineNumber, getTypeAnnotation, outputNamespaceNodes`

Methods inherited from interface net.sf.saxon.om.Item
`getTypedValue`

Constructor Detail

### TextFragmentValue

    public TextFragmentValue(java.lang.CharSequence value,
                             java.lang.String systemId)

  Constructor: create a result tree fragment containing a single text node

Method Detail

### setConfiguration

    public void setConfiguration(Configuration config)

  Set the configuration (containing the name pool used for all names in this document)

  Specified by:
    `setConfiguration` in interface `DocumentInfo`
  Parameters:
    `config` - The configuration to be used

### getConfiguration

    public Configuration getConfiguration()

  Get the configuration previously set using setConfiguration (or the default configuraton allocated automatically)

  Specified by:
    `getConfiguration` in interface `DocumentInfo`

### getNamePool

    public NamePool getNamePool()

  Get the name pool used for the names in this document

  Specified by:
    `getNamePool` in interface `DocumentInfo`
  Returns:
    the name pool in which all the names used in this document are registered

### getDocumentNumber

    public int getDocumentNumber()

  Get the unique document number

  Specified by:
    `getDocumentNumber` in interface `DocumentInfo`
  Overrides:
    `getDocumentNumber` in class `AbstractNode`
  Returns:
    the unique number identifying this document within the name pool

### getNodeKind

    public final int getNodeKind()

  Return the type of node.

  Specified by:
    `getNodeKind` in interface `NodeInfo`
  Returns:
    Type.DOCUMENT (always)
  See Also:
    `Type`

### getStringValue

    public java.lang.String getStringValue()

  Get the String Value

  Specified by:
    `getStringValue` in interface `NodeInfo`
  Specified by:
    `getStringValue` in class `AbstractNode`
  Returns:
    the string value of the node

### isSameNodeInfo

    public boolean isSameNodeInfo(NodeInfo other)

  Determine whether this is the same node as another node

  Specified by:
    `isSameNodeInfo` in interface `NodeInfo`
  Specified by:
    `isSameNodeInfo` in class `AbstractNode`
  Parameters:
    `other` - the node to be compared with this node
  Returns:
    true if this Node object and the supplied Node object represent the same node in the tree.

### generateId

    public java.lang.String generateId()

  Get a character string that uniquely identifies this node

  Specified by:
    `generateId` in interface `NodeInfo`
  Specified by:
    `generateId` in class `AbstractNode`
  Returns:
    a string.

### setSystemId

    public void setSystemId(java.lang.String systemId)

  Set the system ID for the entity containing the node.

  Specified by:
    `setSystemId` in interface `javax.xml.transform.Source`

### getSystemId

    public java.lang.String getSystemId()

  Get the system ID for the entity containing the node.

  Specified by:
    `getSystemId` in interface `NodeInfo`
  Specified by:
    `getSystemId` in class `AbstractNode`
  Returns:
    the System Identifier of the entity in the source document containing the node, or null if not known. Note this is not the same as the base URI: the base URI can be modified by xml:base, but the system ID cannot.

### getBaseURI

    public java.lang.String getBaseURI()

  Get the base URI for the node. Default implementation for child nodes gets the base URI of the parent node.

  Specified by:
    `getBaseURI` in interface `NodeInfo`
  Specified by:
    `getBaseURI` in class `AbstractNode`
  Returns:
    the base URI of the node

### compareOrder

    public int compareOrder(NodeInfo other)

  Determine the relative position of this node and another node, in document order. The other node will always be in the same document.

  Specified by:
    `compareOrder` in interface `NodeInfo`
  Specified by:
    `compareOrder` in class `AbstractNode`
  Parameters:
    `other` - The other node, whose position is to be compared with this node
  Returns:
    -1 if this node precedes the other node, +1 if it follows the other node, or 0 if they are the same node. (In this case, isSameNode() will always return true, and the two nodes will produce the same result for generateId())

### getNameCode

    public int getNameCode()

  Get the name code of the node, used for displaying names

  Specified by:
    `getNameCode` in interface `NodeInfo`
  Specified by:
    `getNameCode` in class `AbstractNode`
  Returns:
    an integer name code, which may be used to obtain the actual node name from the name pool
  See Also:
    `allocate`, `getFingerprint`

### getFingerprint

    public int getFingerprint()

  Get the fingerprint of the node, used for matching names

  Specified by:
    `getFingerprint` in interface `NodeInfo`
  Specified by:
    `getFingerprint` in class `AbstractNode`
  Returns:
    an integer fingerprint; two nodes with the same fingerprint have the same expanded QName

### getPrefix

    public java.lang.String getPrefix()

  Get the prefix part of the name of this node. This is the name before the ":" if any.

  Specified by:
    `getPrefix` in interface `org.w3c.dom.Node`
  Returns:
    the prefix part of the name. For an unnamed node, return "".

### getURI

    public java.lang.String getURI()

  Get the URI part of the name of this node. This is the URI corresponding to the prefix, or the URI of the default namespace if appropriate.

  Specified by:
    `getURI` in interface `NodeInfo`
  Specified by:
    `getURI` in class `AbstractNode`
  Returns:
    The URI of the namespace of this node. For an unnamed node, or for an element or attribute in the default namespace, return an empty string.

### getDisplayName

    public java.lang.String getDisplayName()

  Get the display name of this node. For elements and attributes this is [prefix:]localname. For unnamed nodes, it is an empty string.

  Specified by:
    `getDisplayName` in interface `NodeInfo`
  Overrides:
    `getDisplayName` in class `AbstractNode`
  Returns:
    The display name of this node. For a node with no name, return an empty string.

### getLocalPart

    public java.lang.String getLocalPart()

  Get the local name of this node.

  Specified by:
    `getLocalPart` in interface `NodeInfo`
  Specified by:
    `getLocalPart` in class `AbstractNode`
  Returns:
    The local name of this node. For a node with no name, return "".

### hasChildNodes

    public boolean hasChildNodes()

  Determine whether the node has any children.

  Specified by:
    `hasChildNodes` in interface `NodeInfo`
  Specified by:
    `hasChildNodes` in class `AbstractNode`
  Returns:
    `true` if this node has any attributes, `false` otherwise.

### hasAttributes

    public boolean hasAttributes()

  Returns whether this node has any attributes.

  Specified by:
    `hasAttributes` in interface `org.w3c.dom.Node`
  Specified by:
    `hasAttributes` in class `AbstractNode`
  Returns:
    `true` if this node has any attributes, `false` otherwise.
  Since:
    DOM Level 2

### getAttributeValue

    public java.lang.String getAttributeValue(int fingerprint)

  Get the value of a given attribute of this node

  Specified by:
    `getAttributeValue` in interface `NodeInfo`
  Specified by:
    `getAttributeValue` in class `AbstractNode`
  Parameters:
    `fingerprint` - The fingerprint of the attribute name
  Returns:
    the attribute value if it exists or null if not

### iterateAxis

    public AxisIterator iterateAxis(byte axisNumber)

  Return an iteration over the nodes reached by the given axis from this node

  Specified by:
    `iterateAxis` in interface `NodeInfo`
  Parameters:
    `axisNumber` - The axis to be iterated over
  Returns:
    a AxisIterator that scans the nodes reached by the axis in turn.
  See Also:
    `Axis`

### iterateAxis

    public AxisIterator iterateAxis(byte axisNumber,
                                    NodeTest nodeTest)

  Return an enumeration over the nodes reached by the given axis from this node

  Specified by:
    `iterateAxis` in interface `NodeInfo`
  Specified by:
    `iterateAxis` in class `AbstractNode`
  Parameters:
    `axisNumber` - The axis to be iterated over
    `nodeTest` - A pattern to be matched by the returned nodes
  Returns:
    a AxisIterator that scans the nodes reached by the axis in turn.
  See Also:
    `Axis`

### getParent

    public NodeInfo getParent()

  Find the parent node of this node.

  Specified by:
    `getParent` in interface `NodeInfo`
  Specified by:
    `getParent` in class `AbstractNode`
  Returns:
    The Node object describing the containing element or root node.

### getRoot

    public NodeInfo getRoot()

  Get the root node

  Specified by:
    `getRoot` in interface `NodeInfo`
  Overrides:
    `getRoot` in class `AbstractNode`
  Returns:
    the NodeInfo representing the root of this tree

### getDocumentRoot

    public DocumentInfo getDocumentRoot()

  Get the root (document) node

  Specified by:
    `getDocumentRoot` in interface `NodeInfo`
  Overrides:
    `getDocumentRoot` in class `AbstractNode`
  Returns:
    the DocumentInfo representing the containing document

### copy

    public void copy(Receiver out,
                     int whichNamespaces,
                     boolean copyAnnotations,
                     int locationId)
              throws XPathException

  Copy the result tree fragment value to a given Outputter

  Specified by:
    `copy` in interface `NodeInfo`
  Parameters:
    `out` - the Receiver to which the node should be copied
    `whichNamespaces` - in the case of an element, controls which namespace nodes should be copied. Values are NO_NAMESPACES, LOCAL_NAMESPACES, ALL_NAMESPACES
    `copyAnnotations` - indicates whether the type annotations of element and attribute nodes should be copied
    `locationId` - Identifies the location of the instruction that requested this copy. Pass zero if no other information is available
  Throws:
    `XPathException`

### selectID

    public NodeInfo selectID(java.lang.String id)

  Get the element with a given ID.

  Specified by:
    `selectID` in interface `DocumentInfo`
  Parameters:
    `id` - The unique ID of the required element
  Returns:
    null (this kind of tree contains no elements)

### getUnparsedEntity

    public java.lang.String[] getUnparsedEntity(java.lang.String name)

  Get the unparsed entity with a given name

  Specified by:
    `getUnparsedEntity` in interface `DocumentInfo`
  Parameters:
    `name` - the name of the entity
  Returns:
    the URI and public ID of the entity if there is one, or null if not