com.icl.saxon.tree
Class NamespaceImpl

java.lang.Object
  |
  +--com.icl.saxon.tree.NodeImpl
        |
        +--com.icl.saxon.tree.NamespaceImpl
All Implemented Interfaces:
NamespaceInfo, org.w3c.dom.Node, NodeInfo

public class NamespaceImpl
extends com.icl.saxon.tree.NodeImpl
implements NamespaceInfo

A node in the XML parse tree representing a Namespace. Note that this is generated only "on demand", when the namespace axis is expanded.


Field Summary
protected static NodeInfo[] emptyArray
           
protected  int index
           
protected  com.icl.saxon.tree.ParentNodeImpl parent
           
 
Fields inherited from interface com.icl.saxon.om.NodeInfo
ATTRIBUTE, COMMENT, DOCUMENT, ELEMENT, NAMESPACE, NODE, NONE, NUMBER_OF_TYPES, PI, 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
 
Constructor Summary
NamespaceImpl(ElementImpl element, java.lang.String prefix, java.lang.String uri, int index)
          Construct a Namespace node
 
Method Summary
protected static java.lang.String alphaKey(int value)
          Construct an alphabetic key from an positive integer; the key collates in the same sequence as the integer
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          Adds the node newChild to the end of the list of children of this node.
 org.w3c.dom.Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
 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)
protected  void disallowUpdate()
          Internal method used to indicate that update operations are not allowed
 java.lang.String getAbsoluteName()
          Get the absolute name of this node.
 NodeInfo[] getAllChildNodes()
          Get all child nodes of the node - default implementation used for leaf nodes
 ElementInfo getAncestor(Name name)
          Get the nearest ancestor element with a given name
 NodeInfo getAncestor(Pattern pat, Context c)
          Get the nearest ancestor node that matches the given pattern
 org.w3c.dom.NamedNodeMap getAttributes()
          Return a NamedNodeMap containing the attributes of this node (if it is an Element ) or null otherwise.
 java.lang.String getAttributeValue(Name name)
          Find 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.
 org.w3c.dom.NodeList getChildNodes()
          Return a NodeList that contains all children of this node.
 int getColumnNumber()
          Get the column number of the 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
 Name getExpandedName()
          Get the name of this namespace node
 org.w3c.dom.Node getFirstChild()
          Get first child - default implementation used for leaf nodes
 NodeInfo getFirstChild(Pattern pattern, Context c)
          Get the first child node matching a given pattern
 int getIndex()
          Get the index of this node, i.e.
 org.w3c.dom.Node getLastChild()
          Get last child - default implementation used for leaf nodes
 NodeInfo getLastChild(Pattern pattern, Context c)
          Get the last child node matching a given pattern
 int getLineNumber()
          Get the line number of the node within its source document entity
 java.lang.String getLocalName()
          Get the local name of this node.
 java.lang.String getNamespacePrefix()
          Get the prefix of the namespace that this node relates to
 java.lang.String getNamespaceURI()
          Get the uri of the namespace that this node relates to
 NodeInfo getNextInDocument()
          Get the next node in document order.
 NodeInfo getNextInDocument(NodeInfo anchor)
          Get the next node in document order
 org.w3c.dom.Node getNextSibling()
          Get next sibling - not defined for namespace nodes
 NodeInfo getNextSibling(Pattern pattern, Context c)
          Get the next sibling node that matches a given pattern.
 java.lang.String getNodeName()
          Get the name of this node, following the DOM rules (which aren't actually defined for Namespace nodes...)
 short getNodeType()
          Return the type of node.
static java.lang.String getNodeTypeName(int type)
          Translate numeric node type to a string representation
 java.lang.String getNodeValue()
          Get the node value as defined in the DOM.
 int getNumberAny(Pattern count, Pattern from)
          Get node number, level=any.
 int getNumberAny(Pattern count, Pattern from, Context context)
          Get node number (level="any").
 java.util.Vector getNumberMulti(Pattern count, Pattern from)
          Get node number, level=multi.
 java.util.Vector getNumberMulti(Pattern count, Pattern from, Context context)
          Get node number (level="multi").
 int getNumberOfChildren()
          Get the number of children.
 int getNumberSimple()
          Get simple node number.
 int getNumberSimple(Context context)
          Get simple node number.
 int getNumberSingle(Pattern count, Pattern from)
          Get node number, level=single.
 int getNumberSingle(Pattern count, Pattern from, Context context)
          Get node number (level="single").
 org.w3c.dom.Document getOwnerDocument()
          Return the Document object associated with this node.
 org.w3c.dom.Node getParentNode()
          Find the parent node of this node.
 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.
 NodeInfo getPreviousInDocument(Pattern pattern, Context c)
          Get the previous node in document order
 org.w3c.dom.Node getPreviousSibling()
          Get previous sibling - not defined for namespace nodes
 NodeInfo getPreviousSibling(Pattern pattern, Context c)
          Get the previous sibling of the node that matches a given pattern.
 java.lang.String getPublicId()
          Get the public identifier of the document entity containing this node.
 long getSequenceNumber()
          Get the node sequence number (in document order).
 java.lang.String getSequentialKey()
          Get sequential key.
 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.
 java.lang.String getValue()
          Return the string value of the node.
 boolean hasAttributes()
          Returns whether this node (if it is an element) has any attributes.
 boolean hasChildNodes()
          Determine whether the node has any children.
 boolean hasName(Name name)
          Test if the name of the node (including namespaces) is equivalent to the given name
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
          Insert the node newChild before the existing child node refChild.
 boolean isa(int nodeType)
          Determine whether the node is of a given type.
 boolean isAncestor(NodeInfo other)
          Determine whether this node is an ancestor of another node
 boolean isDocumentElement()
          Determine whether this node is the outermost element.
 boolean isSameNode(NodeInfo other)
          Determine whether this is the same node as another node
 boolean isSupported(java.lang.String feature, java.lang.String version)
          Test if the DOM implementation implements a specific feature.
 void normalize()
          Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          Remove the child node indicated by oldChild from the list of children, and returns it.
 void removeNode()
          Remove this node from the tree.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          Replace the child node oldChild with newChild in the list of children, and returns the oldChild node.
 void setNamespacePrefix(java.lang.String prefix)
          Set the prefix of the namespace that this node relates to
 void setNamespaceURI(java.lang.String uri)
          Set the uri of the namespace that this node relates to
 void setNodeValue(java.lang.String nodeValue)
          Set the node value.
 void setPrefix(java.lang.String prefix)
          Set the namespace prefix of this node.
 boolean supports(java.lang.String feature, java.lang.String version)
          Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
 java.lang.String toString()
          Diagnostic output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.icl.saxon.om.NodeInfo
copyStringValue, getAbsoluteName, getAllChildNodes, getAncestor, getAncestor, getAttributeValue, getAttributeValue, getDisplayName, getDocumentElement, getDocumentRoot, getFirstChild, getIndex, getLastChild, getLineNumber, getLocalName, getNextInDocument, getNextSibling, getNumberAny, getNumberMulti, getNumberOfChildren, getNumberSimple, getNumberSimple, getNumberSingle, getPrefix, getPreviousInDocument, getPreviousSibling, getSystemId, getURI, hasName, isa, isAncestor, isDocumentElement
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getNodeValue, getOwnerDocument, getParentNode, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

emptyArray

protected static NodeInfo[] emptyArray

parent

protected com.icl.saxon.tree.ParentNodeImpl parent

index

protected int index
Constructor Detail

NamespaceImpl

public NamespaceImpl(ElementImpl element,
                     java.lang.String prefix,
                     java.lang.String uri,
                     int index)
              throws org.xml.sax.SAXException
Construct a Namespace node
Parameters:
element - The element containing the relevant attribute
prefix - The namespace prefix (empty string for the default namespace)
uri - The namespace uri
index - Integer identifying this namespace node among the nodes for its parent
Method Detail

isSameNode

public boolean isSameNode(NodeInfo other)
Determine whether this is the same node as another node
Specified by:
isSameNode in interface NodeInfo
Overrides:
isSameNode in class com.icl.saxon.tree.NodeImpl
Returns:
true if this Node object and the supplied Node object represent the same node in the tree.

getNamespacePrefix

public java.lang.String getNamespacePrefix()
Get the prefix of the namespace that this node relates to
Specified by:
getNamespacePrefix in interface NamespaceInfo

getNamespaceURI

public java.lang.String getNamespaceURI()
Get the uri of the namespace that this node relates to
Specified by:
getNamespaceURI in interface NamespaceInfo
Overrides:
getNamespaceURI in class com.icl.saxon.tree.NodeImpl

setNamespacePrefix

public void setNamespacePrefix(java.lang.String prefix)
Set the prefix of the namespace that this node relates to
Specified by:
setNamespacePrefix in interface NamespaceInfo

setNamespaceURI

public void setNamespaceURI(java.lang.String uri)
Set the uri of the namespace that this node relates to
Specified by:
setNamespaceURI in interface NamespaceInfo

getNodeType

public final short getNodeType()
Return the type of node.
Specified by:
getNodeType in interface NodeInfo
Returns:
NodeInfo.NAMESPACE

getValue

public java.lang.String getValue()
Return the string value of the node.
Specified by:
getValue in interface NodeInfo
Returns:
the namespace uri

getExpandedName

public Name getExpandedName()
Get the name of this namespace node
Specified by:
getExpandedName in interface NodeInfo
Returns:
The namespace name. This is always a simple name with no prefix or uri.

getNodeName

public java.lang.String getNodeName()
Get the name of this node, following the DOM rules (which aren't actually defined for Namespace nodes...)
Specified by:
getNodeName in interface NodeInfo
Overrides:
getNodeName in class com.icl.saxon.tree.NodeImpl
Returns:
the namespace prefix

getNextSibling

public org.w3c.dom.Node getNextSibling()
Get next sibling - not defined for namespace nodes
Specified by:
getNextSibling in interface org.w3c.dom.Node
Overrides:
getNextSibling in class com.icl.saxon.tree.NodeImpl
Following copied from class: com.icl.saxon.tree.NodeImpl
Returns:
The next sibling node of the required type. Returns null if the current node is the last child of its parent.

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()
Get previous sibling - not defined for namespace nodes
Specified by:
getPreviousSibling in interface org.w3c.dom.Node
Overrides:
getPreviousSibling in class com.icl.saxon.tree.NodeImpl
Following copied from class: com.icl.saxon.tree.NodeImpl
Returns:
The previous sibling node. Returns null if the current node is the first child of its parent.

getPreviousInDocument

public NodeInfo getPreviousInDocument()
Get the previous node in document order. Not supported for namespace nodes.
Specified by:
getPreviousInDocument in interface NodeInfo
Overrides:
getPreviousInDocument in class com.icl.saxon.tree.NodeImpl
Following copied from interface: com.icl.saxon.om.NodeInfo
Returns:
the previous node in the document, or null if there is no such node

getNextInDocument

public NodeInfo getNextInDocument()
Get the next node in document order. Not supported for namespace nodes.
Throws:
SAXException, - always

getNumberSingle

public int getNumberSingle(Pattern count,
                           Pattern from)
                    throws org.xml.sax.SAXException
Get node number, level=single. Not supported for namespace nodes.
Throws:
org.xml.sax.SAXException -  

getNumberAny

public int getNumberAny(Pattern count,
                        Pattern from)
                 throws org.xml.sax.SAXException
Get node number, level=any. Not supported for namespace nodes.
Throws:
org.xml.sax.SAXException -  

getNumberMulti

public java.util.Vector getNumberMulti(Pattern count,
                                       Pattern from)
                                throws org.xml.sax.SAXException
Get node number, level=multi. Not supported for namespace nodes.
Throws:
org.xml.sax.SAXException -  

getSequentialKey

public java.lang.String getSequentialKey()
Get sequential key. Returns key of owning element with the namespace prefix as a suffix
Specified by:
getSequentialKey in interface NodeInfo
Overrides:
getSequentialKey in class com.icl.saxon.tree.NodeImpl
Following copied from interface: com.icl.saxon.om.NodeInfo
Returns:
a string. The string is always interned so keys can be compared using "==".

copy

public void copy(Outputter out)
          throws org.xml.sax.SAXException
Copy this node to a given outputter
Specified by:
copy in interface NodeInfo

defaultAction

public void defaultAction(Context c)
Perform default action for this kind of node (built-in template rule)
Specified by:
defaultAction in interface NodeInfo

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.
Specified by:
getSequenceNumber in interface NodeInfo
Overrides:
getSequenceNumber in class com.icl.saxon.tree.NodeImpl

getPath

public java.lang.String getPath()
Generate a path to this node
Specified by:
getPath in interface NodeInfo

toString

public java.lang.String toString()
Diagnostic output
Overrides:
toString in class com.icl.saxon.tree.NodeImpl

getSystemId

public java.lang.String getSystemId()
Get the base URL for the node. Default implementation for child nodes.
Specified by:
getSystemId in interface NodeInfo
Following copied from interface: com.icl.saxon.om.NodeInfo
Returns:
the System Identifier of the entity in the source document containing the node, or null if not known

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 NodeInfo
Returns:
the prefix part of the name. For an unnamed node, return null.

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

getAbsoluteName

public java.lang.String getAbsoluteName()
Get the absolute name of this node. For elements and attributes this is [uri^]localname. For other nodes, it is the same as the display name
Specified by:
getAbsoluteName in interface NodeInfo
Returns:
The absolute name of this node. For a node with no name, return an empty string.

getLocalName

public java.lang.String getLocalName()
Get the local name of this node.
Specified by:
getLocalName in interface NodeInfo
Returns:
The local name of this node. For a node with no name, return an empty string.

hasName

public boolean hasName(Name name)
Test if the name of the node (including namespaces) is equivalent to the given name
Specified by:
hasName in interface NodeInfo

getLineNumber

public int getLineNumber()
Get the line number of the node within its source document entity
Specified by:
getLineNumber in interface NodeInfo
Following copied from interface: com.icl.saxon.om.NodeInfo
Returns:
the line number of the node in its original source document; or -1 if not available

getColumnNumber

public int getColumnNumber()
Get the column number of the node. This is not currently maintained, so return -1

getPublicId

public java.lang.String getPublicId()
Get the public identifier of the document entity containing this node. This is not currently maintained: return null

getIndex

public final int getIndex()
Get the index of this node, i.e. its position among its siblings
Specified by:
getIndex in interface NodeInfo
Following copied from interface: com.icl.saxon.om.NodeInfo
Returns:
the number of preceding sibling nodes at the same level

getParentNode

public final org.w3c.dom.Node getParentNode()
Find the parent node of this node.
Specified by:
getParentNode in interface org.w3c.dom.Node
Returns:
The Node object describing the containing element or root node.

getFirstChild

public org.w3c.dom.Node getFirstChild()
Get first child - default implementation used for leaf nodes
Specified by:
getFirstChild in interface org.w3c.dom.Node
Returns:
null

getLastChild

public org.w3c.dom.Node getLastChild()
Get last child - default implementation used for leaf nodes
Specified by:
getLastChild in interface org.w3c.dom.Node
Returns:
null

getNumberOfChildren

public int getNumberOfChildren()
Get the number of children.
Specified by:
getNumberOfChildren in interface NodeInfo

getAllChildNodes

public NodeInfo[] getAllChildNodes()
Get all child nodes of the node - default implementation used for leaf nodes
Specified by:
getAllChildNodes in interface NodeInfo
Returns:
an empty array

isa

public final boolean isa(int nodeType)
Determine whether the node is of a given type.

Note, this can also be done by testing the node using "instanceof". But this is inconvenient when passing the class as a parameter to another routine.

Specified by:
isa in interface NodeInfo
Parameters:
nodeType - One of the specific node types such as ELEMENT or TEXT, or the general node type NODE
Returns:
true if the node is an instance of the specified node type

getAttributeValue

public java.lang.String getAttributeValue(Name 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.
Specified by:
getAttributeValue in interface NodeInfo
Parameters:
name - the name of an 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.
Specified by:
getAttributeValue in interface NodeInfo
Parameters:
name - the name of an attribute. This must be an unqualified attribute name, i.e. one with no namespace prefix.
Returns:
the value of the attribute, if it exists, otherwise null

getAncestor

public final ElementInfo getAncestor(Name name)
Get the nearest ancestor element with a given name
Specified by:
getAncestor in interface NodeInfo
Parameters:
name - The name of the required ancestor.
Returns:
The NodeInfo for the nearest ancestor with the given tag; null if there is no such ancestor

getAncestor

public final NodeInfo getAncestor(Pattern pat,
                                  Context c)
                           throws org.xml.sax.SAXException
Get the nearest ancestor node that matches the given pattern
Specified by:
getAncestor in interface NodeInfo
Parameters:
pattern - A pattern that the ancestor node must satisfy.
Returns:
The NodeInfo for the nearest ancestor node that matches the given pattern; null if there is no such ancestor

isDocumentElement

public boolean isDocumentElement()
Determine whether this node is the outermost element.
Specified by:
isDocumentElement in interface NodeInfo
Returns:
True if this element is the document (outermost) element.

isAncestor

public boolean isAncestor(NodeInfo other)
Determine whether this node is an ancestor of another node
Specified by:
isAncestor in interface NodeInfo
Parameters:
other - the other node (the putative descendant of this node)
Returns:
true of this node is an ancestor of the other node

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Get the outermost element.
Specified by:
getDocumentElement in interface NodeInfo
Returns:
the ElementInfo for the outermost element of the document. If the document is not well-formed, this returns the last element child of the root if there is one, otherwise null.

getDocumentRoot

public DocumentInfo getDocumentRoot()
Get the root (document) node
Specified by:
getDocumentRoot in interface NodeInfo
Returns:
the DocumentInfo representing the containing document

getNextSibling

public final NodeInfo getNextSibling(Pattern pattern,
                                     Context c)
                              throws org.xml.sax.SAXException
Get the next sibling node that matches a given pattern.
Specified by:
getNextSibling in interface NodeInfo
Parameters:
pattern - The match-pattern that the required sibling must match
Returns:
The NodeInfo object describing the next node at the same level. Returns null if there is no subsequent child of the same parent that matches the supplied pattern.

getNextInDocument

public NodeInfo getNextInDocument(NodeInfo anchor)
Get the next node in document order
Specified by:
getNextInDocument in interface NodeInfo
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

getFirstChild

public final NodeInfo getFirstChild(Pattern pattern,
                                    Context c)
                             throws org.xml.sax.SAXException
Get the first child node matching a given pattern
Specified by:
getFirstChild in interface NodeInfo
Parameters:
pattern - the pattern to be matched
Returns:
the the first child node of the required type, or null if there is no such child

getPreviousSibling

public final NodeInfo getPreviousSibling(Pattern pattern,
                                         Context c)
                                  throws org.xml.sax.SAXException
Get the previous sibling of the node that matches a given pattern.
Specified by:
getPreviousSibling in interface NodeInfo
Parameters:
pattern - The match-pattern that the required sibling must match
Returns:
The NodeInfo object describing the previous node at the same level that matches the pattern. Returns null if there is no previous child of the same parent that matches the supplied pattern.

getPreviousInDocument

public final NodeInfo getPreviousInDocument(Pattern pattern,
                                            Context c)
                                     throws org.xml.sax.SAXException
Get the previous node in document order
Specified by:
getPreviousInDocument in interface NodeInfo
Parameters:
pattern: - identifies a pattern the required node
Returns:
the previous node in the document of the required type, or null if there is no such node

getLastChild

public final NodeInfo getLastChild(Pattern pattern,
                                   Context c)
                            throws org.xml.sax.SAXException
Get the last child node matching a given pattern
Specified by:
getLastChild in interface NodeInfo
Parameters:
pattern - the pattern to be matched
Returns:
the the last child node of the required type, or null if there is no such child

copyStringValue

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

getNumberSimple

public int getNumberSimple(Context context)
Get simple node number. This is defined as one plus the number of previous siblings of the same node type and name. It is not accessible directly in XSL.
Specified by:
getNumberSimple in interface NodeInfo
Parameters:
context - Used for remembering previous result, for performance

getNumberSimple

public int getNumberSimple()
Get simple node number. This is defined as one plus the number of previous siblings of the same node type and name. It is not accessible directly in XSL. This version doesn't require the context, and therefore doesn't remember previous results
Specified by:
getNumberSimple in interface NodeInfo

getNumberSingle

public int getNumberSingle(Pattern count,
                           Pattern from,
                           Context context)
                    throws org.xml.sax.SAXException
Get node number (level="single"). If the current node matches the supplied pattern, the returned number is one plus the number of previous siblings that match the pattern. Otherwise, return the element number of the nearest ancestor that matches the supplied pattern.
Specified by:
getNumberSingle in interface NodeInfo
Parameters:
count - Pattern that identifies which nodes should be counted. Default (null) is the element name if the current node is an element, or "node()" otherwise.
from - Pattern that specifies where counting starts from. Default (null) is the root node. (This parameter does not seem useful but is included for the sake of XSLT conformance.)
Returns:
the node number established as follows: go to the nearest ancestor-or-self that matches the 'count' pattern and that is a descendant of the nearest ancestor that matches the 'from' pattern. Return one plus the nunber of preceding siblings of that ancestor that match the 'count' pattern. If there is no such ancestor, return 0.

getNumberAny

public int getNumberAny(Pattern count,
                        Pattern from,
                        Context context)
                 throws org.xml.sax.SAXException
Get node number (level="any"). Return one plus the number of previous nodes in the document that match the supplied pattern
Specified by:
getNumberAny in interface NodeInfo
Parameters:
count - Pattern that identifies which nodes should be counted. Default (null) is the element name if the current node is an element, or "node()" otherwise.
from - Pattern that specifies where counting starts from. Default (null) is the root node. Only nodes after the first (most recent) node that matches the 'from' pattern are counted.
Returns:
one plus the number of nodes that precede the current node, that match the count pattern, and that follow the first node that matches the from pattern if specified.

getNumberMulti

public java.util.Vector getNumberMulti(Pattern count,
                                       Pattern from,
                                       Context context)
                                throws org.xml.sax.SAXException
Get node number (level="multi"). Return a vector giving the hierarchic position of this node. See the XSLT spec for details.
Specified by:
getNumberMulti in interface NodeInfo
Parameters:
count - Pattern that identifies which nodes (ancestors and their previous siblings) should be counted. Default (null) is the element name if the current node is an element, or "node()" otherwise.
from - Pattern that specifies where counting starts from. Default (null) is the root node. Only nodes below the first (most recent) node that matches the 'from' pattern are counted.
Returns:
a vector containing for each ancestor-or-self that matches the count pattern and that is below the nearest node that matches the from pattern, an Integer which is one greater than the number of previous siblings that match the count pattern.

alphaKey

protected static java.lang.String alphaKey(int value)
Construct an alphabetic key from an positive integer; the key collates in the same sequence as the integer
Parameters:
value - The positive integer key value (negative values are treated as zero).

removeNode

public void removeNode()
                throws org.xml.sax.SAXException
Remove this node from the tree. For system use only. When one or more nodes have been removed, renumberChildren() must be called to adjust the numbering of remaining nodes. PRECONDITION: The node must have a parent node.

getNodeTypeName

public static java.lang.String getNodeTypeName(int type)
Translate numeric node type to a string representation

getNodeValue

public java.lang.String getNodeValue()
Get the node value as defined in the DOM. This is not the same as the XPath string-value.
Specified by:
getNodeValue in interface org.w3c.dom.Node

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws org.w3c.dom.DOMException
Set the node value. DOM method: always fails
Specified by:
setNodeValue in interface org.w3c.dom.Node

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Return a NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.
Specified by:
getChildNodes in interface org.w3c.dom.Node

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Return a NamedNodeMap containing the attributes of this node (if it is an Element ) or null otherwise. (DOM method)
Specified by:
getAttributes in interface org.w3c.dom.Node

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Return the Document object associated with this node. (DOM mehod)
Specified by:
getOwnerDocument in interface org.w3c.dom.Node

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Insert the node newChild before the existing child node refChild. DOM method: always fails.
Specified by:
insertBefore in interface org.w3c.dom.Node
Parameters:
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Always raised.

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Replace the child node oldChild with newChild in the list of children, and returns the oldChild node. Always fails.
Specified by:
replaceChild in interface org.w3c.dom.Node
Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node replaced.
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Always raised.

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Remove the child node indicated by oldChild from the list of children, and returns it. DOM method: always fails.
Specified by:
removeChild in interface org.w3c.dom.Node
Parameters:
oldChild - The node being removed.
Returns:
The node removed.
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Always raised.

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Adds the node newChild to the end of the list of children of this node. DOM method: always fails.
Specified by:
appendChild in interface org.w3c.dom.Node
Parameters:
newChild - The node to add.
Returns:
The node added.
Throws:
org.w3c.dom.DOMException -
NO_MODIFICATION_ALLOWED_ERR: Always raised.

hasChildNodes

public boolean hasChildNodes()
Determine whether the node has any children.
Specified by:
hasChildNodes in interface org.w3c.dom.Node
Returns:
true if the node has any children, false if the node has no children.

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent. Not implemented: always returns null. (Because trees are read-only, there would be no way of using the resulting node.)
Specified by:
cloneNode in interface org.w3c.dom.Node
Parameters:
deep - If true , recursively clone the subtree under the specified node; if false , clone only the node itself (and its attributes, if it is an Element ).
Returns:
The duplicate node.

normalize

public void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
Specified by:
normalize in interface org.w3c.dom.Node
Since:
DOM Level 2

supports

public boolean supports(java.lang.String feature,
                        java.lang.String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Parameters:
feature - The name of the feature to test. This is the same name which can be passed to the method hasFeature on DOMImplementation .
version - This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to return true .
Returns:
Returns true if the specified feature is supported on this node, false otherwise.
Since:
DOM Level 2

setPrefix

public void setPrefix(java.lang.String prefix)
               throws org.w3c.dom.DOMException
Set the namespace prefix of this node. Always fails.
Specified by:
setPrefix in interface org.w3c.dom.Node

disallowUpdate

protected void disallowUpdate()
                       throws org.w3c.dom.DOMException
Internal method used to indicate that update operations are not allowed

hasAttributes

public boolean hasAttributes()
Returns whether this node (if it is an element) has any attributes.
Specified by:
hasAttributes in interface org.w3c.dom.Node
Returns:
true if this node has any attributes, false otherwise.
Since:
DOM Level 2

isSupported

public boolean isSupported(java.lang.String feature,
                           java.lang.String version)
Test if the DOM implementation implements a specific feature.
Specified by:
isSupported in interface org.w3c.dom.Node
Parameters:
feature - The name of the feature to test (case-insensitive).
version - This is the version number of the feature to test.
Returns:
true if the feature is implemented in the specified version, false otherwise.