com.icl.saxon.om
Interface ElementInfo

All Superinterfaces:
org.w3c.dom.Node, NodeInfo
All Known Implementing Classes:
ElementImpl, ElementWithAttributes

public interface ElementInfo
extends NodeInfo

A node in the XML parse tree representing an XML element.

The ElementInfo provides information about the element and its context. Information available includes the tag and attributes of the element, and pointers to the parent element and the previous element at the same level.


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
 
Method Summary
 void addNamespaceNodes(ElementInfo owner, java.util.Vector list, NodeInfo stop)
          Make the set of all namespace nodes associated with this element.
 AttributeCollection getAttributeList()
          Get the attribute list for this element.
 java.lang.String getInheritedAttribute(Name name)
          Find the value of an inherited attribute.
 java.lang.String getPrefixForURI(java.lang.String uri)
          Search the NamespaceList for a given URI, returning the corresponding prefix.
 java.lang.String getURIforPrefix(java.lang.String prefix)
          Search the NamespaceList for a given prefix, returning the corresponding URI.
 boolean isFirstChild()
          Determine whether this element is the first child of its parent.
 boolean isFirstInGroup()
          Determine whether this element is the first in a consecutive group.
 boolean isLastChild()
          Determine whether this element is the last child element of its parent.
 boolean isLastInGroup()
          Determine whether this element is the last in a consecutive group.
 AttributeInfo makeAttributeNode(Name attributeName)
          Make an attribute node for a given attribute of this element
 void outputNamespaceNodes(Outputter out)
          Output all namespace nodes associated with this element.
 void setAttribute(java.lang.String name, java.lang.String value)
          Set the value of an attribute on the current element.
 
Methods inherited from interface com.icl.saxon.om.NodeInfo
copy, copyStringValue, defaultAction, getAbsoluteName, getAllChildNodes, getAncestor, getAncestor, getAttributeValue, getAttributeValue, getDisplayName, getDocumentElement, getDocumentRoot, getExpandedName, getFirstChild, getIndex, getLastChild, getLineNumber, getLocalName, getNextInDocument, getNextSibling, getNodeName, getNodeType, getNumberAny, getNumberMulti, getNumberOfChildren, getNumberSimple, getNumberSimple, getNumberSingle, getPath, getPrefix, getPreviousInDocument, getPreviousInDocument, getPreviousSibling, getSequenceNumber, getSequentialKey, getSystemId, getURI, getValue, hasName, isa, isAncestor, isDocumentElement, isSameNode
 
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
 

Method Detail

getAttributeList

public AttributeCollection getAttributeList()
Get the attribute list for this element.
Returns:
The attribute list (as in the SAX interface). If you are using the Distributor and you have not called setOptions(RETAIN_ATTRIBUTES) and this is not the startElement() call for the element, the attribute list will be null.

getInheritedAttribute

public java.lang.String getInheritedAttribute(Name name)
                                       throws org.xml.sax.SAXException
Find the value of an inherited attribute. The current element, its parent, and its ancestors are searched recursively to find an attribute with the given name.
Parameters:
name - the name of the attribute
Returns:
the value of the attribute, if it is defined on this element or on an ancestor element; otherwise null

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws org.xml.sax.SAXException
Set the value of an attribute on the current element. This affects subsequent calls of getAttribute() for that element. It also alters the value of the attribute in the DOM if using the DOM.
Parameters:
name - The name of the attribute to be set.
value - The new value of the attribute. Set this to null to remove the attribute.

makeAttributeNode

public AttributeInfo makeAttributeNode(Name attributeName)
                                throws org.xml.sax.SAXException
Make an attribute node for a given attribute of this element
Parameters:
name - The attribute name

getURIforPrefix

public java.lang.String getURIforPrefix(java.lang.String prefix)
                                 throws org.xml.sax.SAXException
Search the NamespaceList for a given prefix, returning the corresponding URI.
Parameters:
prefix - The prefix to be matched. To find the default namespace, supply ""
Returns:
The URI corresponding to this namespace. If it is an unnamed default namespace, return "".
Throws:
org.xml.sax.SAXException - if the prefix has not been declared on this element or a containing element.

getPrefixForURI

public java.lang.String getPrefixForURI(java.lang.String uri)
Search the NamespaceList for a given URI, returning the corresponding prefix.
Parameters:
uri - The URI to be matched. To find the default namespace, supply ""
Returns:
The prefix corresponding to this URI. If not found, return null.

addNamespaceNodes

public void addNamespaceNodes(ElementInfo owner,
                              java.util.Vector list,
                              NodeInfo stop)
                       throws org.xml.sax.SAXException
Make the set of all namespace nodes associated with this element.
Parameters:
owner - The element node to own these namespace nodes
list - a vector containing NamespaceInfo objects representing the namespaces in scope for this element; the method appends nodes to this Vector, which should initially be empty.
stop - the ancestor node to stop at. Supply null to go all the way back to the Document node

outputNamespaceNodes

public void outputNamespaceNodes(Outputter out)
                          throws org.xml.sax.SAXException
Output all namespace nodes associated with this element.
Parameters:
out - The relevant outputter

isFirstInGroup

public boolean isFirstInGroup()
                       throws org.xml.sax.SAXException
Determine whether this element is the first in a consecutive group. A consecutive group is a group of elements of the same type subordinate to the same parent element; there can be intervening character data, white space, or processing instructions, but no elements of a different type.
Returns:
True if this is the first child of its parent, or if the previous child was a different element type, or if this element is the root.

isLastInGroup

public boolean isLastInGroup()
                      throws org.xml.sax.SAXException
Determine whether this element is the last in a consecutive group. A consecutive group is a group of elements of the same type subordinate to the same parent element; there can be intervening character data, white space, or processing instructions, but no elements of a different type.
Returns:
True if this is the last child of its parent, or if the next child is a different element type, or if this element is the root.
Throws:
org.xml.sax.SAXException - Note that this method is supported when using direct access to the document (using the Wanderer); when processing serially using the Distributor, it is supported using lookahead during end-tag processing only

isFirstChild

public boolean isFirstChild()
                     throws org.xml.sax.SAXException
Determine whether this element is the first child of its parent.
Returns:
True if this element is the first child of its parent, or if it is the root element.

isLastChild

public boolean isLastChild()
                    throws org.xml.sax.SAXException
Determine whether this element is the last child element of its parent.
Returns:
True if this element is the last child element of its parent, or if it is the root element.
Throws:
org.xml.sax.SAXException - Note that this method is only supported when using direct access to the document (using the Wanderer); it throws an exception if used when processing serially using the Distributor.