Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.icl.saxon.tree
Class ElementImpl

    java.lang.Object
      |
      +--com.icl.saxon.om.AbstractNode
            |
            +--com.icl.saxon.tree.NodeImpl
                  |
                  +--com.icl.saxon.tree.ParentNodeImpl
                        |
                        +--com.icl.saxon.tree.ElementImpl

All Implemented Interfaces:
  javax.xml.transform.dom.DOMLocator, org.w3c.dom.Element, org.w3c.dom.Node, NodeInfo, javax.xml.transform.Source, javax.xml.transform.SourceLocator

Direct Known Subclasses:
  ElementWithAttributes

public class ElementImpl
extends com.icl.saxon.tree.ParentNodeImpl
implements org.w3c.dom.Element

ElementImpl implements an element with no attributes or namespace declarations.

This class is an implementation of NodeInfo. For elements with attributes or namespace declarations, class ElementWithAttributes is used.

Field Summary
`protected int` | `nameCode`
`protected DocumentImpl` | `root`
`protected int` | `sequence`

Fields inherited from class com.icl.saxon.tree.NodeImpl
`emptyArray, index, parent`

Fields inherited from class com.icl.saxon.om.AbstractNode
`NODE_LETTER`

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`

Fields inherited from interface com.icl.saxon.om.NodeInfo
`ATTRIBUTE, COMMENT, ELEMENT, NAMESPACE, NODE, NONE, NUMBER_OF_TYPES, PI, ROOT, TEXT`

Constructor Summary
`ElementImpl()` Construct an empty ElementImpl

Method Summary
`void` | `addChild(NodeImpl node, int index)` Add a child node to this node.
`void` | `addNamespaceNodes(ElementImpl owner, java.util.Vector list, boolean addXML)` Make the set of all namespace nodes associated with this element.
`void` | `compact(int size)` Compact the space used by this node
`void` | `copy(Outputter out)` Copy this node to a given outputter (supporting xsl:copy-of)
`void` | `copy(Outputter out, boolean allNamespaces)` Copy this node to a given outputter (supporting xsl:copy-of)
`void` | `copyStringValue(Outputter out)` Copy the string-value of this node to a given outputter
`void` | `dropChildren()` Drop a branch of the tree.
`AxisEnumeration` | `enumerateChildren(NodeTest test)` Get an enumeration of the children of this node
`java.lang.String` | `generateId()` Get a character string that uniquely identifies this node within this document (The calling code will prepend a document identifier)
`AttributeCollection` | `getAttributeList()` Get the attribute list for this element.
`java.lang.String` | `getAttributeValue(java.lang.String name)` Find the value of a given attribute of this element.
`java.lang.String` | `getBaseURI()` Get the base URI of this element node.
`org.w3c.dom.NodeList` | `getChildNodes()` Return a `NodeList` that contains all children of this node.
`DocumentInfo` | `getDocumentRoot()` Get the root node
`org.w3c.dom.Node` | `getFirstChild()` Get the first child node of the element
`org.w3c.dom.Node` | `getLastChild()` Get the last child node of the element
`int` | `getLineNumber()` Get the line number of the node within its source document entity
`int` | `getNameCode()` Get the nameCode of the node.
`short` | `getNodeType()` Return the type of node.
`java.lang.String` | `getNodeValue()` Get the node value as defined in the DOM.
`protected NodeImpl` | `getNthChild(int n)` Get the nth child node of the element (numbering from 0)
`java.lang.String` | `getPrefixForURI(java.lang.String uri)` Search the NamespaceList for a given URI, returning the corresponding prefix.
`protected long` | `getSequenceNumber()` Get the node sequence number (in document order).
`java.lang.String` | `getStringValue()` Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.
`java.lang.String` | `getSystemId()` Get the system ID of the entity containing this element node.
`short` | `getURICodeForPrefix(java.lang.String prefix)` Search the NamespaceList for a given prefix, returning the corresponding URI.
`boolean` | `hasChildNodes()` Determine if the node has any children.
`void` | `initialise(int nameCode, AttributeCollection atts, NodeInfo parent, java.lang.String baseURI, int lineNumber, int sequenceNumber)` Initialise a new ElementImpl with an element name
`int` | `makeNameCode(java.lang.String qname, boolean useDefault)` Make a NameCode, using this Element as the context for namespace resolution.
`void` | `outputNamespaceNodes(Outputter out, boolean includeAncestors)` Output all namespace nodes associated with this element.
`void` | `removeChild(int index)` Remove node at given index.
`void` | `renumberChildren()` Renumber the children of a given parent node.
`void` | `setAttribute(java.lang.String name, java.lang.String value)` Set the value of an attribute on the current element.
`void` | `setLineNumber(int line)` Set the line number of the element within its source document entity
`void` | `setNameCode(int nameCode)` Set the name code.
`void` | `setSystemId(java.lang.String uri)` Set the system ID of this node.
`void` | `useChildrenArray(NodeImpl[] array)` Supply an array to be used for the array of children.

Methods inherited from class com.icl.saxon.tree.NodeImpl
`compareOrder, getAttributes, getAttributeValue, getAttributeValue, getDisplayName, getDocumentElement, getEnumeration, getFingerprint, getLocalName, getNamePool, getNextInDocument, getNextSibling, getOriginatingNode, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getURI, hasAttributes, isSameNode, removeNode`

Methods inherited from class com.icl.saxon.om.AbstractNode
`appendChild, appendData, cloneNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, disallowUpdate, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getColumnNumber, getData, getDoctype, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getLength, getName, getNamespaceURI, getNodeName, getOwnerDocument, getOwnerElement, getParentNode, getPublicId, getSpecified, getTagName, getValue, hasAttribute, hasAttributeNS, importNode, insertBefore, insertData, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setNodeValue, setPrefix, setValue, splitText, substringData, supports`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Element
`getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNode, setAttributeNodeNS, setAttributeNS`

Methods inherited from interface org.w3c.dom.Node
`appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix`

Field Detail

### nameCode

    protected int nameCode

### root

    protected DocumentImpl root

### sequence

    protected int sequence

Constructor Detail

### ElementImpl

    public ElementImpl()

  Construct an empty ElementImpl

Method Detail

### setNameCode

    public void setNameCode(int nameCode)

  Set the name code. Used when creating a dummy element in the Stripper

### initialise

    public void initialise(int nameCode,
                           AttributeCollection atts,
                           NodeInfo parent,
                           java.lang.String baseURI,
                           int lineNumber,
                           int sequenceNumber)

  Initialise a new ElementImpl with an element name
  Parameters:
    `name` - The element name, with namespaces resolved
    `atts` - The attribute list: always null
    `parent` - The parent node

### setSystemId

    public void setSystemId(java.lang.String uri)

  Set the system ID of this node. This method is provided so that a NodeInfo implements the javax.xml.transform.Source interface, allowing a node to be used directly as the Source of a transformation
  Overrides:
    `setSystemId` in class `NodeImpl`

### getDocumentRoot

    public DocumentInfo getDocumentRoot()

  Get the root node
  Overrides:
    `getDocumentRoot` in class `NodeImpl`
  Following copied from class: `com.icl.saxon.tree.NodeImpl`
  Returns:
    the DocumentInfo representing the containing document

### getSystemId

    public final java.lang.String getSystemId()

  Get the system ID of the entity containing this element node.
  Overrides:
    `getSystemId` in class `NodeImpl`
  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. 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

    public java.lang.String getBaseURI()

  Get the base URI of this element node. This will be the same as the System ID unless xml:base has been used.
  Overrides:
    `getBaseURI` in class `NodeImpl`

### setLineNumber

    public void setLineNumber(int line)

  Set the line number of the element within its source document entity

### getLineNumber

    public int getLineNumber()

  Get the line number of the node within its source document entity
  Overrides:
    `getLineNumber` in class `NodeImpl`
  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

### getNameCode

    public int getNameCode()

  Get the nameCode of the node. This is used to locate the name in the NamePool
  Overrides:
    `getNameCode` in class `NodeImpl`
  Following copied from interface: `com.icl.saxon.om.NodeInfo`
  See Also:
    `allocate`, `getFingerprint`

### generateId

    public java.lang.String generateId()

  Get a character string that uniquely identifies this node within this document (The calling code will prepend a document identifier)
  Overrides:
    `generateId` in class `NodeImpl`
  Returns:
    a string.

### getURICodeForPrefix

    public short getURICodeForPrefix(java.lang.String prefix)
                              throws NamespaceException

  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 code corresponding to this namespace. If it is an unnamed default namespace, return Namespace.NULL_CODE.
  Throws:
    `NamespaceException` - if the prefix has not been declared on this NamespaceList.

### 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.
  Returns:
    The prefix corresponding to this URI. If not found, return null. If there is more than one prefix matching the URI, the first one found is returned. If the URI matches the default namespace, return an empty string.

### makeNameCode

    public final int makeNameCode(java.lang.String qname,
                                  boolean useDefault)
                           throws NamespaceException

  Make a NameCode, using this Element as the context for namespace resolution. The name will be entered in the namepool: therefore this method should not be called once the name pool is sealed.
  Parameters:
    `qname` - The name as written, in the form "[prefix:]localname"

### addNamespaceNodes

    public void addNamespaceNodes(ElementImpl owner,
                                  java.util.Vector list,
                                  boolean addXML)

  Make the set of all namespace nodes associated with this element.
  Parameters:
    `owner` - The element owning these namespace nodes.
    `list` - a Vector containing NamespaceImpl objects representing the namespaces in scope for this element; the method appends nodes to this Vector, which should initially be empty. Note that the returned list will never contain the XML namespace (to get this, the NamespaceEnumeration class adds it itself). The list WILL include an entry for the undeclaration xmlns=""; again it is the job of NamespaceEnumeration to ignore this, since it doesn't represent a true namespace node.
    `addXML` - Add the XML namespace node to the list

### outputNamespaceNodes

    public void outputNamespaceNodes(Outputter out,
                                     boolean includeAncestors)
                              throws javax.xml.transform.TransformerException

  Output all namespace nodes associated with this element.
  Overrides:
    `outputNamespaceNodes` in class `NodeImpl`
  Parameters:
    `out` - The relevant outputter

### getNodeType

    public final short getNodeType()

  Return the type of node.
  Specified by:
    `getNodeType` in interface `org.w3c.dom.Node`
  Returns:
    NodeInfo.ELEMENT

### getAttributeList

    public AttributeCollection getAttributeList()

  Get the attribute list for this element.
  Returns:
    The attribute list. This will not include any namespace attributes. The attribute names will be in expanded form, with prefixes replaced by URIs

### getAttributeValue

    public java.lang.String getAttributeValue(java.lang.String name)

  Find the value of a given attribute of this element.
  This is a short-cut method; the full capability to examine attributes is offered via the getAttributeList() method.
  The attribute may either be one that was present in the original XML document, or one that has been set by the application using setAttribute().
  Parameters:
    `name` - the name of an attribute. There must be no prefix in the name.
  Returns:
    the value of the attribute, if it exists, otherwise null

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.String value)
                      throws org.w3c.dom.DOMException

  Set the value of an attribute on the current element.
  Specified by:
    `setAttribute` in interface `org.w3c.dom.Element`
  Throws:
    `org.w3c.dom.DOMException` - (always): the Saxon tree is immutable

### copy

    public void copy(Outputter out)
              throws javax.xml.transform.TransformerException

  Copy this node to a given outputter (supporting xsl:copy-of)

### copy

    public void copy(Outputter out,
                     boolean allNamespaces)
              throws javax.xml.transform.TransformerException

  Copy this node to a given outputter (supporting xsl:copy-of)
  Parameters:
    `out` - The outputter
    `allNamespaces` - true if namespaces for ancestor nodes must be output

### getSequenceNumber

    protected final 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.
  Overrides:
    `getSequenceNumber` in class `NodeImpl`

### hasChildNodes

    public final boolean hasChildNodes()

  Determine if the node has any children.
  Overrides:
    `hasChildNodes` in class `NodeImpl`
  Following copied from class: `com.icl.saxon.tree.NodeImpl`
  Returns:
    `true` if the node has any children, `false` if the node has no children.

### enumerateChildren

    public final AxisEnumeration enumerateChildren(NodeTest test)

  Get an enumeration of the children of this node

### getFirstChild

    public final org.w3c.dom.Node getFirstChild()

  Get the first child node of the element
  Overrides:
    `getFirstChild` in class `NodeImpl`
  Returns:
    the first child node of the required type, or null if there are no children

### getLastChild

    public final org.w3c.dom.Node getLastChild()

  Get the last child node of the element
  Overrides:
    `getLastChild` in class `NodeImpl`
  Returns:
    the last child of the element, or null if there are no children

### getChildNodes

    public final 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.
  Overrides:
    `getChildNodes` in class `NodeImpl`

### getNthChild

    protected final NodeImpl getNthChild(int n)

  Get the nth child node of the element (numbering from 0)
  Returns:
    the last child of the element, or null if there is no n'th child

### getStringValue

    public java.lang.String getStringValue()

  Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.
  Returns:
    the accumulated character content of the element, including descendant elements.

### copyStringValue

    public void copyStringValue(Outputter out)
                         throws javax.xml.transform.TransformerException

  Copy the string-value of this node to a given outputter
  Overrides:
    `copyStringValue` in class `AbstractNode`

### useChildrenArray

    public void useChildrenArray(NodeImpl[] array)

  Supply an array to be used for the array of children. For system use only.

### addChild

    public void addChild(NodeImpl node,
                         int index)

  Add a child node to this node. For system use only. Note: normalizing adjacent text nodes is the responsibility of the caller.

### removeChild

    public void removeChild(int index)

  Remove node at given index. Will always be followed by a renumberChildren().

### renumberChildren

    public void renumberChildren()

  Renumber the children of a given parent node. For system use only

### dropChildren

    public void dropChildren()

  Drop a branch of the tree. The target element remains in the tree, but its children are disconnected from the parent. Unless there are other references to the children (e.g. in a variable) they will be deleted from memory next time the garbage collector comes round.

### compact

    public void compact(int size)

  Compact the space used by this node

### 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.
  Overrides:
    `getNodeValue` in class `AbstractNode`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD