com.icl.saxon.om
Interface NodeInfo
- All Superinterfaces:
- javax.xml.transform.Source
- All Known Subinterfaces:
- DocumentInfo
- All Known Implementing Classes:
- AbsentExtensionElement, AbstractNode, AttributeImpl, CommentImpl, DocumentImpl, DocumentWrapper, ElementImpl, ElementWithAttributes, LiteralResultElement, NamespaceImpl, NodeImpl, NodeWrapper, ParentNodeImpl, ProcInstImpl, SAXONAssign, SAXONDoctype, SAXONEntityRef, SAXONFunction, SAXONGroup, SAXONHandler, SAXONItem, SAXONPreview, SAXONReturn, SAXONWhile, SQLClose, SQLColumn, SQLConnect, SQLInsert, StyleElement, TextImpl, TinyAttributeImpl, TinyCommentImpl, TinyDocumentImpl, TinyElementImpl, TinyNamespaceImpl, TinyNodeImpl, TinyParentNodeImpl, TinyProcInstImpl, TinyTextImpl, XSLApplyImports, XSLApplyTemplates, XSLAttribute, XSLAttributeSet, XSLCallTemplate, XSLChoose, XSLComment, XSLCopy, XSLCopyOf, XSLDecimalFormat, XSLDocument, XSLElement, XSLFallback, XSLForEach, XSLGeneralIncorporate, XSLGeneralOutput, XSLGeneralVariable, XSLIf, XSLImport, XSLInclude, XSLKey, XSLMessage, XSLNamespaceAlias, XSLNumber, XSLOtherwise, XSLOutput, XSLParam, XSLPreserveSpace, XSLProcessingInstruction, XSLScript, XSLSort, XSLStringConstructor, XSLStyleSheet, XSLTemplate, XSLText, XSLValueOf, XSLVariable, XSLWhen, XSLWithParam
public interface NodeInfo
- extends javax.xml.transform.Source
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.
- Author:
- Michael H. Kay
Method Summary |
int |
compareOrder(NodeInfo other)
Determine the relative position of this node and another node, in document order. |
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 |
java.lang.String |
generateId()
Get a character string that uniquely identifies this node.
Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) |
java.lang.String |
getAttributeValue(int fingerprint)
Get 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 |
getBaseURI()
Get the Base URI for the node, that is, the URI used for resolving a relative URI contained
in the node. |
java.lang.String |
getDisplayName()
Get the display name of this node. |
DocumentInfo |
getDocumentRoot()
Get the root (document) node |
AxisEnumeration |
getEnumeration(byte axisNumber,
NodeTest nodeTest)
Return an enumeration over the nodes reached by the given axis from this node |
int |
getFingerprint()
Get fingerprint. |
int |
getLineNumber()
Get line number |
java.lang.String |
getLocalName()
Get the local part of the name of this node. |
int |
getNameCode()
Get name code. |
short |
getNodeType()
Return the type of node. |
NodeInfo |
getParent()
Get the NodeInfo object representing the parent of this node |
java.lang.String |
getPrefix()
Get the prefix part of the name of this node. |
java.lang.String |
getStringValue()
Return the string value of the node. |
java.lang.String |
getSystemId()
Get the System ID for the node. |
java.lang.String |
getURI()
Get the URI part of the name of this node. |
boolean |
hasChildNodes()
Determine whether the node has any children. |
boolean |
isSameNodeInfo(NodeInfo other)
Determine whether this is the same node as another node. |
void |
outputNamespaceNodes(Outputter out,
boolean includeAncestors)
Output all namespace nodes associated with this element. |
Methods inherited from interface javax.xml.transform.Source |
setSystemId |
NODE
static final short NODE
- See Also:
- Constant Field Values
ELEMENT
static final short ELEMENT
- See Also:
- Constant Field Values
ATTRIBUTE
static final short ATTRIBUTE
- See Also:
- Constant Field Values
TEXT
static final short TEXT
- See Also:
- Constant Field Values
PI
static final short PI
- See Also:
- Constant Field Values
COMMENT
static final short COMMENT
- See Also:
- Constant Field Values
ROOT
static final short ROOT
- See Also:
- Constant Field Values
NAMESPACE
static final short NAMESPACE
- See Also:
- Constant Field Values
NUMBER_OF_TYPES
static final short NUMBER_OF_TYPES
- See Also:
- Constant Field Values
NONE
static final short NONE
- See Also:
- Constant Field Values
getNodeType
short getNodeType()
- Return the type of node.
- Returns:
- one of the values Node.ELEMENT, Node.TEXT, Node.ATTRIBUTE, etc.
isSameNodeInfo
boolean isSameNodeInfo(NodeInfo other)
- Determine whether this is the same node as another node.
Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b)
- Returns:
- true if this Node object and the supplied Node object represent the
same node in the tree.
getSystemId
java.lang.String getSystemId()
- Get the System ID for the node.
- Specified by:
getSystemId
in interface javax.xml.transform.Source
- 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
java.lang.String getBaseURI()
- Get the Base URI for the node, that is, the URI used for resolving a relative URI contained
in the node. This will be the same as the System ID unless xml:base has been used.
getLineNumber
int getLineNumber()
- Get line number
- Returns:
- the line number of the node in its original source document; or -1 if not available
compareOrder
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.
- 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())
getStringValue
java.lang.String getStringValue()
- Return the string 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
getNameCode
int getNameCode()
- Get name code. The name code is a coded form of the node name: two nodes
with the same name code have the same namespace URI, the same local name,
and the same prefix. By masking the name code with &0xfffff, you get a
fingerprint: two nodes with the same fingerprint have the same local name
and namespace URI.
- See Also:
allocate
,
getFingerprint
getFingerprint
int getFingerprint()
- Get fingerprint. The fingerprint is a coded form of the expanded name
of the node: two nodes
with the same name code have the same namespace URI and the same local name.
A fingerprint of -1 should be returned for a node with no name.
getLocalName
java.lang.String getLocalName()
- Get the local part of the name of this node. This is the name after the ":" if any.
- Returns:
- the local part of the name. For an unnamed node, return an empty string.
getPrefix
java.lang.String getPrefix()
- Get the prefix part of the name of this node. This is the name before the ":" if any.
- Returns:
- the prefix part of the name. For an unnamed node, return an empty string.
getURI
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.
getDisplayName
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.
getParent
NodeInfo getParent()
- Get the NodeInfo object representing the parent of this node
getEnumeration
AxisEnumeration getEnumeration(byte axisNumber,
NodeTest nodeTest)
- Return an enumeration over the nodes reached by the given axis from this node
- Parameters:
axisNumber
- the axis to be followed (a constant in class Axis
)nodeTest
- A pattern to be matched by the returned nodes
- Returns:
- a NodeEnumeration that scans the nodes reached by the axis in turn.
getAttributeValue
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
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
getDocumentRoot
DocumentInfo getDocumentRoot()
- Get the root (document) node
- Returns:
- the DocumentInfo representing the containing document
hasChildNodes
boolean hasChildNodes()
- Determine whether the node has any children.
Note: the result is equivalent to
getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasMoreElements()
generateId
java.lang.String generateId()
- Get a character string that uniquely identifies this node.
Note: a.isSameNode(b) if and only if generateId(a)==generateId(b)
- Returns:
- a string that uniquely identifies this node, within this
document. The calling code prepends information to make the result
unique across all documents.
copy
void copy(Outputter out)
throws javax.xml.transform.TransformerException
- Copy this node to a given outputter
- Throws:
javax.xml.transform.TransformerException
copyStringValue
void copyStringValue(Outputter out)
throws javax.xml.transform.TransformerException
- Copy the string-value of this node to a given outputter
- Throws:
javax.xml.transform.TransformerException
outputNamespaceNodes
void outputNamespaceNodes(Outputter out,
boolean includeAncestors)
throws javax.xml.transform.TransformerException
- Output all namespace nodes associated with this element. Does nothing if
the node is not an element.
- Parameters:
out
- The relevant outputterincludeAncestors
- True if namespaces declared on ancestor elements must
be output; false if it is known that these are already on the result tree
- Throws:
javax.xml.transform.TransformerException