net.sf.saxon.tree
Class ProcInstImpl

java.lang.Object
  extended by net.sf.saxon.tree.NodeImpl
      extended by net.sf.saxon.tree.ProcInstImpl
All Implemented Interfaces:
Source, SourceLocator, PullEvent, FingerprintedNode, Item, MutableNodeInfo, NodeInfo, SiblingCountingNode, ValueRepresentation

 class ProcInstImpl
extends NodeImpl

ProcInstImpl is an implementation of ProcInstInfo used by the Propagator to construct its trees.

Author:
Michael H. Kay

Field Summary
(package private)  String content
           
(package private)  int lineNumber
           
(package private)  int nameCode
           
(package private)  String systemId
           
 
Fields inherited from class net.sf.saxon.tree.NodeImpl
index, NODE_LETTER, parent
 
Fields inherited from interface net.sf.saxon.om.NodeInfo
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
 
Constructor Summary
ProcInstImpl(int nameCode, String content)
           
 
Method Summary
 Value atomize()
          Get the typed value of this node.
 void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
          Copy this node to a given outputter
 String getData()
          The content of this processing instruction.
 int getLineNumber()
          Get the line number of the node within its source entity
 int getNameCode()
          Get the nameCode of the node.
 int getNodeKind()
          Get the kind of node.
 String getStringValue()
          Get the value of the item as a string.
 String getSystemId()
          Get the system ID for the entity containing this node.
 String getTarget()
          The target of this processing instruction.
 SequenceIterator getTypedValue()
          Get the typed value of this node.
 void rename(int newNameCode)
          Rename this node
 void replaceStringValue(CharSequence stringValue)
          Replace the string-value of this node
 void setLocation(String uri, int lineNumber)
          Set the system ID and line number
 
Methods inherited from class net.sf.saxon.tree.NodeImpl
addAttribute, addNamespace, compareOrder, delete, equals, generateId, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getFirstChild, getLastChild, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getRoot, getSequenceNumber, getSiblingPosition, getStringValueCS, getTypeAnnotation, getURI, hasChildNodes, insertChildren, insertSiblings, isDeleted, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis, newBuilder, removeAttribute, removeTypeAnnotation, replace, setSystemId, setTypeAnnotation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.saxon.om.NodeInfo
hashCode
 

Field Detail

content

String content

nameCode

int nameCode

systemId

String systemId

lineNumber

int lineNumber
Constructor Detail

ProcInstImpl

public ProcInstImpl(int nameCode,
                    String content)
Method Detail

getNameCode

public int getNameCode()
Get the nameCode of the node. This is used to locate the name in the NamePool

Specified by:
getNameCode in interface NodeInfo
Overrides:
getNameCode in class NodeImpl
Returns:
an integer name code, which may be used to obtain the actual node name from the name pool. For unnamed nodes (text nodes, comments, document nodes, and namespace nodes for the default namespace), returns -1.
See Also:
allocate, getFingerprint

getStringValue

public String getStringValue()
Description copied from interface: Item
Get the value of the item as a string. For nodes, this is the string value of the node as defined in the XPath 2.0 data model, except that all nodes are treated as being untyped: it is not an error to get the string value of a node with a complex type. For atomic values, the method returns the result of casting the atomic value to a string.

If the calling code can handle any CharSequence, the method Item.getStringValueCS() should be used. If the caller requires a string, this method is preferred.

Returns:
the string value of the item
See Also:
Item.getStringValueCS()

getTypedValue

public SequenceIterator getTypedValue()
Get the typed value of this node. Returns the string value, as an instance of xs:string

Specified by:
getTypedValue in interface Item
Overrides:
getTypedValue in class NodeImpl
Returns:
an iterator over the items in the typed value of the node or atomic value. The items returned by this iterator will always be atomic values.

atomize

public Value atomize()
Get the typed value of this node. Returns the string value, as an instance of xs:string

Specified by:
atomize in interface NodeInfo
Overrides:
atomize in class NodeImpl
Returns:
the typed value. If requireSingleton is set to true, the result will always be an AtomicValue. In other cases it may be a Value representing a sequence whose items are atomic values.

getNodeKind

public final int getNodeKind()
Description copied from interface: NodeInfo
Get the kind of node. This will be a value such as Type.ELEMENT or Type.ATTRIBUTE. There are seven kinds of node: documents, elements, attributes, text, comments, processing-instructions, and namespaces.

Returns:
an integer identifying the kind of node. These integer values are the same as those used in the DOM
See Also:
Type

setLocation

public void setLocation(String uri,
                        int lineNumber)
Set the system ID and line number

Parameters:
uri - the system identifier
lineNumber - the line number

getSystemId

public String getSystemId()
Get the system ID for the entity containing this node.

Specified by:
getSystemId in interface Source
Specified by:
getSystemId in interface SourceLocator
Specified by:
getSystemId in interface NodeInfo
Overrides:
getSystemId in class NodeImpl
Returns:
the system identifier

getLineNumber

public int getLineNumber()
Get the line number of the node within its source entity

Specified by:
getLineNumber in interface SourceLocator
Specified by:
getLineNumber in interface NodeInfo
Overrides:
getLineNumber in class NodeImpl
Returns:
the line number of the node in its original source document; or -1 if not available

copy

public void copy(Receiver out,
                 int whichNamespaces,
                 boolean copyAnnotations,
                 int locationId)
          throws XPathException
Copy this node to a given outputter

Parameters:
out - the Receiver to which the node should be copied. It is the caller's responsibility to ensure that this Receiver is open before the method is called (or that it is self-opening), and that it is closed after use.
whichNamespaces - in the case of an element, controls which namespace nodes should be copied. Values are NodeInfo.NO_NAMESPACES, NodeInfo.LOCAL_NAMESPACES, NodeInfo.ALL_NAMESPACES
copyAnnotations - indicates whether the type annotations of element and attribute nodes should be copied
locationId - If non-zero, identifies the location of the instruction that requested this copy. If zero, indicates that the location information for the original node is to be copied; in this case the Receiver must be a LocationCopier
Throws:
XPathException

getTarget

public String getTarget()
The target of this processing instruction. XML defines this as being the first token following the markup that begins the processing instruction.

Returns:
the processing instruction name

getData

public String getData()
The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the ?> .

Returns:
the string value of the processing instruction node

rename

public void rename(int newNameCode)
Rename this node

Specified by:
rename in interface MutableNodeInfo
Overrides:
rename in class NodeImpl
Parameters:
newNameCode - the NamePool code of the new name

replaceStringValue

public void replaceStringValue(CharSequence stringValue)
Replace the string-value of this node

Parameters:
stringValue - the new string value