Class TinyElementImpl

All Implemented Interfaces:
NodeInfo, DOMLocator, Source, SourceLocator, Element, Node

final class TinyElementImpl extends TinyParentNodeImpl implements Element
A node in the XML parse tree representing an XML element.

This class is an implementation of NodeInfo and also implements the DOM Element interface

Author:
Michael H. Kay
  • Constructor Details

    • TinyElementImpl

      public TinyElementImpl(TinyDocumentImpl doc, int nodeNr)
      Constructor
  • Method Details

    • getNodeType

      public final short getNodeType()
      Return the type of node.
      Specified by:
      getNodeType in interface Node
      Specified by:
      getNodeType in interface NodeInfo
      Returns:
      NodeInfo.ELEMENT
    • getBaseURI

      public 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.
      Specified by:
      getBaseURI in interface Node
      Specified by:
      getBaseURI in interface NodeInfo
      Overrides:
      getBaseURI in class TinyNodeImpl
    • outputNamespaceNodes

      public void outputNamespaceNodes(Outputter out, boolean includeAncestors) throws TransformerException
      Output all namespace nodes associated with this element.
      Specified by:
      outputNamespaceNodes in interface NodeInfo
      Overrides:
      outputNamespaceNodes in class TinyNodeImpl
      Parameters:
      out - The relevant outputter
      includeAncestors - True if namespaces associated with ancestor elements must also be output; false if these are already known to be on the result tree.
      Throws:
      TransformerException
    • hasAttributes

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

      public String getAttributeValue(String uri, 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.
      Specified by:
      getAttributeValue in interface NodeInfo
      Overrides:
      getAttributeValue in class TinyNodeImpl
      Parameters:
      uri - the namespace uri of an attribute
      localName - the local name of an attribute
      Returns:
      the value of the attribute, if it exists, otherwise null
    • getAttributeValue

      public String getAttributeValue(int fingerprint)
      Get the value of a given attribute of this node
      Specified by:
      getAttributeValue in interface NodeInfo
      Overrides:
      getAttributeValue in class TinyNodeImpl
      Parameters:
      fingerprint - The fingerprint of the attribute name
      Returns:
      the attribute value if it exists or null if not
    • makeAttributeNode

      public TinyAttributeImpl makeAttributeNode(int index)
      Make an attribute node for a given attribute of this element
      Parameters:
      index - The relative position of the attribute, counting from zero. This is trusted to be in range.
    • setAttribute

      public void setAttribute(String name, String value) throws DOMException
      Set the value of an attribute on the current element. This affects subsequent calls of getAttribute() for that element.
      Specified by:
      setAttribute in interface Element
      Parameters:
      name - The name of the attribute to be set. Any prefix is interpreted relative to the namespaces defined for this element.
      value - The new value of the attribute. Set this to null to remove the attribute.
      Throws:
      DOMException
    • copy

      public void copy(Outputter out) throws TransformerException
      Copy this node to a given outputter (supporting xsl:copy-of)
      Specified by:
      copy in interface NodeInfo
      Throws:
      TransformerException
    • copy

      public void copy(Outputter out, boolean allNamespaces) throws TransformerException
      Copy this node to a given outputter
      Parameters:
      allNamespaces - true if all namespace nodes must be copied; false if namespace nodes for the parent element are already on the result tree
      Throws:
      TransformerException