com.icl.saxon.om
Interface NodeInfo

All Superinterfaces:
org.w3c.dom.Node
All Known Subinterfaces:
AttributeInfo, CommentInfo, DocumentInfo, ElementInfo, NamespaceInfo, ProcInstInfo, TextInfo
All Known Implementing Classes:
com.icl.saxon.tree.NodeImpl, com.icl.saxon.tinytree.TinyNodeImpl

public interface NodeInfo
extends org.w3c.dom.Node

A node in the XML parse tree representing an XML element, character content, or attribute.

This is the top class in the interface hierarchy for nodes; see NodeImpl for the implementation hierarchy.


Field Summary
static short ATTRIBUTE
           
static short COMMENT
           
static short ELEMENT
           
static short NAMESPACE
           
static short NODE
           
static java.lang.String[] NODE_TYPE_NAMES
          Array of names of node types.
static short NONE
           
static short NUMBER_OF_TYPES
           
static short PI
           
static short ROOT
           
static short TEXT
           
 
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
 
Method Summary
 void copy(Outputter out)
          Copy this node to a given outputter
 void copyStringValue(Outputter out)
          Copy the string-value of this node to a given outputter
 void defaultAction(Context c)
          Perform default action for this kind of node (built-in template rule)
 NodeEnumeration enumerateChildren()
          Get an enumeration of the children of this node
 NodeInfo[] getAllChildNodes()
          Get all child nodes of the element (child elements and character nodes)
 java.lang.String getAttributeValue(int fingerprint)
          Get the value of a given attribute of this node
 java.lang.String getAttributeValue(java.lang.String name)
          Find the value of a given attribute of this node.
 java.lang.String getAttributeValue(java.lang.String uri, java.lang.String localName)
          Find the value of a given attribute of this node.
 java.lang.String getDisplayName()
          Get the display name of this node.
 org.w3c.dom.Element getDocumentElement()
          Get the outermost element.
 DocumentInfo getDocumentRoot()
          Get the root (document) node
 int getFingerprint()
          Get fingerprint.
 int getIndex()
          Get index: that is, the number of preceding sibling nodes at the same level.
 int getLineNumber()
          Get line number
 java.lang.String getLocalName()
          Get the local part of the name of this node.
 int getNameCode()
          Get name code.
 NodeInfo getNextInDocument(NodeInfo anchor)
          Get the next node in document order
 java.lang.String getNodeName()
          Get the name of this node, following the DOM rules
 short getNodeType()
          Return the type of node.
 int getNumberOfChildren()
          Get the number of children.
 java.lang.String getPath()
          Generate a path to this node
 java.lang.String getPrefix()
          Get the prefix part of the name of this node.
 NodeInfo getPreviousInDocument()
          Get the previous node in document order
 long getSequenceNumber()
          Get the node sequence number (in document order).
 java.lang.String getSequentialKey()
          Get a character string that uniquely identifies this node and that collates nodes into document order
 java.lang.String getSystemId()
          Get the base URL for the node.
 java.lang.String getURI()
          Get the URI part of the name of this node.
 short getURICode()
          Get the URI code of the name
 java.lang.String getValue()
          Return the character value of the node.
 boolean isDocumentElement()
          Determine whether this element is the outermost element.
 boolean isSameNode(NodeInfo other)
          Determine whether this is the same node as another node
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

NODE

public static final short NODE

ELEMENT

public static final short ELEMENT

ATTRIBUTE

public static final short ATTRIBUTE

TEXT

public static final short TEXT

ROOT

public static final short ROOT

PI

public static final short PI

COMMENT

public static final short COMMENT

NAMESPACE

public static final short NAMESPACE

NUMBER_OF_TYPES

public static final short NUMBER_OF_TYPES

NONE

public static final short NONE

NODE_TYPE_NAMES

public static final java.lang.String[] NODE_TYPE_NAMES
Array of names of node types. You can index into this with the numeric node type.
Method Detail

getNodeType

public short getNodeType()
Return the type of node.
Specified by:
getNodeType in interface org.w3c.dom.Node
Returns:
one of the values Node.ELEMENT, Node.TEXT, Node.ATTRIBUTE, etc.

isSameNode

public boolean isSameNode(NodeInfo other)
Determine whether this is the same node as another node
Returns:
true if this Node object and the supplied Node object represent the same node in the tree.

getSystemId

public java.lang.String getSystemId()
Get the base URL for the node.
Returns:
the System Identifier of the entity in the source document containing the node, or null if not known

getLineNumber

public int getLineNumber()
Get line number
Returns:
the line number of the node in its original source document; or -1 if not available

getSequenceNumber

public long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and roots) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position.

getValue

public java.lang.String getValue()
Return the character value of the node. The interpretation of this depends on the type of node. For an element it is the accumulated character content of the element, including descendant elements.
Returns:
the string value of the node

getNodeName

public java.lang.String getNodeName()
Get the name of this node, following the DOM rules
Specified by:
getNodeName in interface org.w3c.dom.Node
Returns:
The name of the node. For an element this is the element name, for an attribute it is the attribute name, as a QName. Other node types return conventional names such as "#text" or "#comment"

getNameCode

public int getNameCode()
Get name code. The name code is a coded form of the node name: two nodes with the same fingerprint have the same namespace URI, the same local name, and the same prefix.

getFingerprint

public int getFingerprint()
Get fingerprint. The fingerprint is a coded form of the node name: two nodes with the same fingerprint have the same namespace URI and the same local name. The fingerprint does not include information about the prefix.

getLocalName

public java.lang.String getLocalName()
Get the local part of the name of this node. This is the name after the ":" if any.
Specified by:
getLocalName in interface org.w3c.dom.Node
Returns:
the local part of the name. For an unnamed node, return an empty string.

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 an empty string.

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.
Returns:
The URI of the namespace of this node. For an unnamed node, return null. For a node with an empty prefix, return an empty string.

getURICode

public short getURICode()
Get the URI code of the name

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.
Returns:
The display name of this node. For a node with no name, return an empty string.

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String uri,
                                          java.lang.String localName)
Find the value of a given attribute of this node.
This method is defined on all nodes to meet XSL requirements, but for nodes other than elements it will always return null.
Parameters:
uri - the namespace uri of an attribute ("" if no namespace)
localname - the local name of the attribute
Returns:
the value of the attribute, if it exists, otherwise null

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
Find the value of a given attribute of this node.
This method is defined on all nodes to meet XSL requirements, but for nodes other than elements it will always return null.
Parameters:
name - the name of an attribute. This must be an unqualified attribute name, i.e. one with no namespace.
Returns:
the value of the attribute, if it exists, otherwise null

getAttributeValue

public java.lang.String getAttributeValue(int fingerprint)
Get the value of a given attribute of this node
Parameters:
fingerprint - The fingerprint of the attribute name
Returns:
the attribute value if it exists or null if not

isDocumentElement

public boolean isDocumentElement()
Determine whether this element is the outermost element.
Returns:
True if this element is the outermost element.

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Get the outermost element.
Returns:
the Element for the outermost element of the document.

getDocumentRoot

public DocumentInfo getDocumentRoot()
Get the root (document) node
Returns:
the DocumentInfo representing the containing document

getNextInDocument

public NodeInfo getNextInDocument(NodeInfo anchor)
Get the next node in document order
Parameters:
anchor: - the scan stops when it reaches a node that is not a descendant of the specified anchor node
Returns:
the next node in the document, or null if there is no such node

getPreviousInDocument

public NodeInfo getPreviousInDocument()
Get the previous node in document order
Returns:
the previous node in the document, or null if there is no such node

getNumberOfChildren

public int getNumberOfChildren()
Get the number of children.

getAllChildNodes

public NodeInfo[] getAllChildNodes()
Get all child nodes of the element (child elements and character nodes)
Returns:
an array containing a NodeInfo for each child node

enumerateChildren

public NodeEnumeration enumerateChildren()
Get an enumeration of the children of this node

getIndex

public int getIndex()
Get index: that is, the number of preceding sibling nodes at the same level. Note this is not defined for attribute nodes.
Returns:
the number of preceding sibling nodes at the same level

getSequentialKey

public java.lang.String getSequentialKey()
Get a character string that uniquely identifies this node and that collates nodes into document order
Returns:
a string.

defaultAction

public void defaultAction(Context c)
                   throws org.xml.sax.SAXException
Perform default action for this kind of node (built-in template rule)

copy

public void copy(Outputter out)
          throws org.xml.sax.SAXException
Copy this node to a given outputter

copyStringValue

public void copyStringValue(Outputter out)
                     throws org.xml.sax.SAXException
Copy the string-value of this node to a given outputter

getPath

public java.lang.String getPath()
Generate a path to this node