Class DTMNodeProxy

java.lang.Object
org.apache.xml.dtm.ref.DTMNodeProxy
All Implemented Interfaces:
Attr, CharacterData, Comment, Document, DocumentFragment, Element, Node, ProcessingInstruction, Text

public class DTMNodeProxy
extends Object
implements Node, Document, Text, Element, Attr, ProcessingInstruction, Comment, DocumentFragment
DTMNodeProxy presents a DOM Node API front-end to the DTM model.

It does _not_ attempt to address the "node identity" question; no effort is made to prevent the creation of multiple proxies referring to a single DTM node. Users can create a mechanism for managing this, or relinquish the use of "==" and use the .sameNodeAs() mechanism, which is under consideration for future versions of the DOM.

DTMNodeProxy may be subclassed further to present specific DOM node types.

See Also:
org.w3c.dom
  • Field Details

    • dtm

      public DTM dtm
      The DTM for this node.
    • fDocumentURI

      protected String fDocumentURI
      DOM Level 3 feature: documentURI
    • actualEncoding

      protected String actualEncoding
      DOM Level 3 feature: Document actualEncoding
  • Constructor Details

    • DTMNodeProxy

      public DTMNodeProxy​(DTM dtm, int node)
      Create a DTMNodeProxy Node representing a specific Node in a DTM
      Parameters:
      dtm - The DTM Reference, must be non-null.
      node - The DTM node handle.
  • Method Details

    • getDTM

      public final DTM getDTM()
      NON-DOM: Return the DTM model
      Returns:
      The DTM that this proxy is a representative for.
    • getDTMNodeNumber

      public final int getDTMNodeNumber()
      NON-DOM: Return the DTM node number
      Returns:
      The DTM node handle.
    • equals

      public final boolean equals​(Node node)
      Test for equality based on node number.
      Parameters:
      node - A DTM node proxy reference.
      Returns:
      true if the given node has the same handle as this node.
    • equals

      public final boolean equals​(Object node)
      Test for equality based on node number.
      Overrides:
      equals in class Object
      Parameters:
      node - A DTM node proxy reference.
      Returns:
      true if the given node has the same handle as this node.
      See Also:
      Object.hashCode()
    • sameNodeAs

      public final boolean sameNodeAs​(Node other)
      FUTURE DOM: Test node identity, in lieu of Node==Node
      Parameters:
      other -
      Returns:
      true if the given node has the same handle as this node.
    • getNodeName

      public final String getNodeName()
      Description copied from interface: Node
      The name of this node, depending on its type; see the table above.
      Specified by:
      getNodeName in interface Node
      See Also:
      Node
    • getTarget

      public final String getTarget()
      A PI's "target" states what processor channel the PI's data should be directed to. It is defined differently in HTML and XML.

      In XML, a PI's "target" is the first (whitespace-delimited) token following the " In HTML, target is always null.

      Note that getNodeName is aliased to getTarget.

      Specified by:
      getTarget in interface ProcessingInstruction
    • getLocalName

      public final String getLocalName()
      Description copied from interface: Node
      Returns the local part of the qualified name of this node.
      For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as Document.createElement(), this is always null.
      Specified by:
      getLocalName in interface Node
      See Also:
      as of DOM Level 2
    • getPrefix

      public final String getPrefix()
      Description copied from interface: Node
      The namespace prefix of this node, or null if it is unspecified. When it is defined to be null, setting it has no effect, including if the node is read-only.
      Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
      Setting the prefix to null makes it unspecified, setting it to an empty string is implementation dependent.
      Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
      For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.
      Specified by:
      getPrefix in interface Node
      Returns:
      The prefix for this node.
      See Also:
      as of DOM Level 2
    • setPrefix

      public final void setPrefix​(String prefix) throws DOMException
      Description copied from interface: Node
      The namespace prefix of this node, or null if it is unspecified. When it is defined to be null, setting it has no effect, including if the node is read-only.
      Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
      Setting the prefix to null makes it unspecified, setting it to an empty string is implementation dependent.
      Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
      For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.
      Specified by:
      setPrefix in interface Node
      Parameters:
      prefix -
      Throws:
      DOMException
      See Also:
      as of DOM Level 2 -- DTMNodeProxy is read-only
    • getNamespaceURI

      public final String getNamespaceURI()
      Description copied from interface: Node
      The namespace URI of this node, or null if it is unspecified (see ).
      This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
      For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as Document.createElement(), this is always null.

      Note: Per the Namespaces in XML Specification [XML Namespaces] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

      Specified by:
      getNamespaceURI in interface Node
      See Also:
      as of DOM Level 2
    • supports

      public final boolean supports​(String feature, String version)
      Ask whether we support a given DOM feature. In fact, we do not _fully_ support any DOM feature -- we're a read-only subset -- so arguably we should always return false. Or we could say that we support DOM Core Level 2 but all nodes are read-only. Unclear which answer is least misleading. NON-DOM method. This was present in early drafts of DOM Level 2, but was renamed isSupported. It's present here only because it's cheap, harmless, and might help some poor fool who is still trying to use an early Working Draft of the DOM.
      Parameters:
      feature -
      version -
      Returns:
      false
    • isSupported

      public final boolean isSupported​(String feature, String version)
      Ask whether we support a given DOM feature. In fact, we do not _fully_ support any DOM feature -- we're a read-only subset -- so arguably we should always return false.
      Specified by:
      isSupported in interface Node
      Parameters:
      feature -
      version -
      Returns:
      false
      See Also:
      as of DOM Level 2
    • getNodeValue

      public final String getNodeValue() throws DOMException
      Description copied from interface: Node
      The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect, including if the node is read-only.
      Specified by:
      getNodeValue in interface Node
      Throws:
      DOMException
      See Also:
      Node
    • getStringValue

      public final String getStringValue() throws DOMException
      Returns:
      The string value of the node
      Throws:
      DOMException
    • setNodeValue

      public final void setNodeValue​(String nodeValue) throws DOMException
      Description copied from interface: Node
      The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect, including if the node is read-only.
      Specified by:
      setNodeValue in interface Node
      Parameters:
      nodeValue -
      Throws:
      DOMException
      See Also:
      -- DTMNodeProxy is read-only
    • getNodeType

      public final short getNodeType()
      Description copied from interface: Node
      A code representing the type of the underlying object, as defined above.
      Specified by:
      getNodeType in interface Node
      See Also:
      Node
    • getParentNode

      public final Node getParentNode()
      Description copied from interface: Node
      The parent of this node. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.
      Specified by:
      getParentNode in interface Node
      See Also:
      Node
    • getOwnerNode

      public final Node getOwnerNode()
      See Also:
      Node
    • getChildNodes

      public final NodeList getChildNodes()
      Description copied from interface: Node
      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 Node
      See Also:
      Node
    • getFirstChild

      public final Node getFirstChild()
      Description copied from interface: Node
      The first child of this node. If there is no such node, this returns null.
      Specified by:
      getFirstChild in interface Node
      See Also:
      Node
    • getLastChild

      public final Node getLastChild()
      Description copied from interface: Node
      The last child of this node. If there is no such node, this returns null.
      Specified by:
      getLastChild in interface Node
      See Also:
      Node
    • getPreviousSibling

      public final Node getPreviousSibling()
      Description copied from interface: Node
      The node immediately preceding this node. If there is no such node, this returns null.
      Specified by:
      getPreviousSibling in interface Node
      See Also:
      Node
    • getNextSibling

      public final Node getNextSibling()
      Description copied from interface: Node
      The node immediately following this node. If there is no such node, this returns null.
      Specified by:
      getNextSibling in interface Node
      See Also:
      Node
    • getAttributes

      public final NamedNodeMap getAttributes()
      Description copied from interface: Node
      A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
      Specified by:
      getAttributes in interface Node
      See Also:
      Node
    • hasAttribute

      public boolean hasAttribute​(String name)
      Method hasAttribute
      Specified by:
      hasAttribute in interface Element
      Parameters:
      name -
      Returns:
      true if an attribute with the given name is specified on this element or has a default value, false otherwise.
    • hasAttributeNS

      public boolean hasAttributeNS​(String namespaceURI, String localName)
      Method hasAttributeNS
      Specified by:
      hasAttributeNS in interface Element
      Parameters:
      namespaceURI -
      localName -
      Returns:
      true if an attribute with the given local name and namespace URI is specified or has a default value on this element, false otherwise.
    • getOwnerDocument

      public final Document getOwnerDocument()
      Description copied from interface: Node
      The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.
      Specified by:
      getOwnerDocument in interface Node
      See Also:
      Node
    • insertBefore

      public final Node insertBefore​(Node newChild, Node refChild) throws DOMException
      Description copied from interface: Node
      Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
      If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.

      Note: Inserting a node before itself is implementation dependent.

      Specified by:
      insertBefore in interface Node
      Parameters:
      newChild -
      refChild -
      Returns:
      The node being inserted.
      Throws:
      DOMException
      See Also:
      -- DTMNodeProxy is read-only
    • replaceChild

      public final Node replaceChild​(Node newChild, Node oldChild) throws DOMException
      Description copied from interface: Node
      Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
      If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed.

      Note: Replacing a node with itself is implementation dependent.

      Specified by:
      replaceChild in interface Node
      Parameters:
      newChild -
      oldChild -
      Returns:
      The node replaced.
      Throws:
      DOMException
      See Also:
      -- DTMNodeProxy is read-only
    • removeChild

      public final Node removeChild​(Node oldChild) throws DOMException
      Description copied from interface: Node
      Removes the child node indicated by oldChild from the list of children, and returns it.
      Specified by:
      removeChild in interface Node
      Parameters:
      oldChild -
      Returns:
      The node removed.
      Throws:
      DOMException
      See Also:
      -- DTMNodeProxy is read-only
    • appendChild

      public final Node appendChild​(Node newChild) throws DOMException
      Description copied from interface: Node
      Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.
      Specified by:
      appendChild in interface Node
      Parameters:
      newChild -
      Returns:
      The node added.
      Throws:
      DOMException
      See Also:
      -- DTMNodeProxy is read-only
    • hasChildNodes

      public final boolean hasChildNodes()
      Description copied from interface: Node
      Returns whether this node has any children.
      Specified by:
      hasChildNodes in interface Node
      Returns:
      Returns true if this node has any children, false otherwise.
      See Also:
      Node
    • cloneNode

      public final Node cloneNode​(boolean deep)
      Description copied from interface: Node
      Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode is null) and no user data. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.
      Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an the Element since the text is contained in a child Text node. Cloning an Attr directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute (specified is true). Cloning an Attr always clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning an EntityReference automatically constructs its subtree if a corresponding Entity is available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node.
      Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly . In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.
      Specified by:
      cloneNode in interface Node
      Parameters:
      deep -
      Returns:
      The duplicate node.
      See Also:
      -- DTMNodeProxy is read-only
    • getDoctype

      public final DocumentType getDoctype()
      Description copied from interface: Document
      The Document Type Declaration (see DocumentType) associated with this document. For XML documents without a document type declaration this returns null. For HTML documents, a DocumentType object may be returned, independently of the presence or absence of document type declaration in the HTML document.
      This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as Node.insertBefore, or Node.replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML" [DOM Level 2 HTML] , based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.
      Specified by:
      getDoctype in interface Document
      See Also:
      Document
    • getImplementation

      public final DOMImplementation getImplementation()
      Description copied from interface: Document
      The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.
      Specified by:
      getImplementation in interface Document
      See Also:
      Document
    • getDocumentElement

      public final Element getDocumentElement()
      This is a bit of a problem in DTM, since a DTM may be a Document Fragment and hence not have a clear-cut Document Element. We can make it work in the well-formed cases but would that be confusing for others?
      Specified by:
      getDocumentElement in interface Document
      See Also:
      Document
    • createElement

      public final Element createElement​(String tagName) throws DOMException
      Description copied from interface: Document
      Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
      In addition, if there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element.
      To create an element with a qualified name and namespace URI, use the createElementNS method.
      Specified by:
      createElement in interface Document
      Parameters:
      tagName -
      Returns:
      A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.
      Throws:
      DOMException
      See Also:
      Document
    • createDocumentFragment

      public final DocumentFragment createDocumentFragment()
      Description copied from interface: Document
      Creates an empty DocumentFragment object.
      Specified by:
      createDocumentFragment in interface Document
      Returns:
      A new DocumentFragment.
      See Also:
      Document
    • createTextNode

      public final Text createTextNode​(String data)
      Description copied from interface: Document
      Creates a Text node given the specified string.
      Specified by:
      createTextNode in interface Document
      Parameters:
      data -
      Returns:
      The new Text object.
      See Also:
      Document
    • createComment

      public final Comment createComment​(String data)
      Description copied from interface: Document
      Creates a Comment node given the specified string.
      Specified by:
      createComment in interface Document
      Parameters:
      data -
      Returns:
      The new Comment object.
      See Also:
      Document
    • createCDATASection

      public final CDATASection createCDATASection​(String data) throws DOMException
      Description copied from interface: Document
      Creates a CDATASection node whose value is the specified string.
      Specified by:
      createCDATASection in interface Document
      Parameters:
      data -
      Returns:
      The new CDATASection object.
      Throws:
      DOMException
      See Also:
      Document
    • createProcessingInstruction

      public final ProcessingInstruction createProcessingInstruction​(String target, String data) throws DOMException
      Description copied from interface: Document
      Creates a ProcessingInstruction node given the specified name and data strings.
      Specified by:
      createProcessingInstruction in interface Document
      Parameters:
      target -
      data -
      Returns:
      The new ProcessingInstruction object.
      Throws:
      DOMException
      See Also:
      Document
    • createAttribute

      public final Attr createAttribute​(String name) throws DOMException
      Description copied from interface: Document
      Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttributeNode method.
      To create an attribute with a qualified name and namespace URI, use the createAttributeNS method.
      Specified by:
      createAttribute in interface Document
      Parameters:
      name -
      Returns:
      A new Attr object with the nodeName attribute set to name, and localName, prefix, and namespaceURI set to null. The value of the attribute is the empty string.
      Throws:
      DOMException
      See Also:
      Document
    • createEntityReference

      public final EntityReference createEntityReference​(String name) throws DOMException
      Description copied from interface: Document
      Creates an EntityReference object. In addition, if the referenced entity is known, the child list of the EntityReference node is made the same as that of the corresponding Entity node.

      Note: If any descendant of the Entity node has an unbound namespace prefix, the corresponding descendant of the created EntityReference node is also unbound; (its namespaceURI is null). The DOM Level 2 and 3 do not support any mechanism to resolve namespace prefixes in this case.

      Specified by:
      createEntityReference in interface Document
      Parameters:
      name -
      Returns:
      The new EntityReference object.
      Throws:
      DOMException
      See Also:
      Document
    • getElementsByTagName

      public final NodeList getElementsByTagName​(String tagname)
      Description copied from interface: Document
      Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.
      Specified by:
      getElementsByTagName in interface Document
      Specified by:
      getElementsByTagName in interface Element
      Parameters:
      tagname -
      Returns:
      A new NodeList object containing all the matched Elements.
      See Also:
      Document
    • importNode

      public final Node importNode​(Node importedNode, boolean deep) throws DOMException
      Description copied from interface: Document
      Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node. The returned node has no parent; (parentNode is null).
      For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and namespaceURI). As in the cloneNode operation, the source node is not altered. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.
      Additional information is copied as appropriate to the nodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for each type of node.
      ATTRIBUTE_NODE
      The ownerElement attribute is set to null and the specified flag is set to true on the generated Attr. The descendants of the source Attr are recursively imported and the resulting nodes reassembled to form the corresponding subtree. Note that the deep parameter has no effect on Attr nodes; they always carry their children with them when imported.
      DOCUMENT_FRAGMENT_NODE
      If the deep option was set to true, the descendants of the source DocumentFragment are recursively imported and the resulting nodes reassembled under the imported DocumentFragment to form the corresponding subtree. Otherwise, this simply generates an empty DocumentFragment.
      DOCUMENT_NODE
      Document nodes cannot be imported.
      DOCUMENT_TYPE_NODE
      DocumentType nodes cannot be imported.
      ELEMENT_NODE
      Specified attribute nodes of the source element are imported, and the generated Attr nodes are attached to the generated Element. Default attributes are not copied, though if the document being imported into defines default attributes for this element name, those are assigned. If the importNode deep parameter was set to true, the descendants of the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
      ENTITY_NODE
      Entity nodes can be imported, however in the current release of the DOM the DocumentType is readonly. Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM.On import, the publicId, systemId, and notationName attributes are copied. If a deep import is requested, the descendants of the the source Entity are recursively imported and the resulting nodes reassembled to form the corresponding subtree.
      ENTITY_REFERENCE_NODE
      Only the EntityReference itself is copied, even if a deep import is requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.
      NOTATION_NODE
      Notation nodes can be imported, however in the current release of the DOM the DocumentType is readonly. Ability to add these imported nodes to a DocumentType will be considered for addition to a future release of the DOM.On import, the publicId and systemId attributes are copied. Note that the deep parameter has no effect on this type of nodes since they cannot have any children.
      PROCESSING_INSTRUCTION_NODE
      The imported node copies its target and data values from those of the source node.Note that the deep parameter has no effect on this type of nodes since they cannot have any children.
      TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE
      These three types of nodes inheriting from CharacterData copy their data and length attributes from those of the source node.Note that the deep parameter has no effect on these types of nodes since they cannot have any children.
      Specified by:
      importNode in interface Document
      Parameters:
      importedNode -
      deep -
      Returns:
      The imported node that belongs to this Document.
      Throws:
      DOMException
      See Also:
      as of DOM Level 2 -- DTMNodeProxy is read-only
    • createElementNS

      public final Element createElementNS​(String namespaceURI, String qualifiedName) throws DOMException
      Description copied from interface: Document
      Creates an element of the given qualified name and namespace URI.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      createElementNS in interface Document
      Parameters:
      namespaceURI -
      qualifiedName -
      Returns:
      A new Element object with the following attributes:
      Attribute Value
      Node.nodeName qualifiedName
      Node.namespaceURI namespaceURI
      Node.prefix prefix, extracted from qualifiedName, or null if there is no prefix
      Node.localName local name, extracted from qualifiedName
      Element.tagName qualifiedName
      Throws:
      DOMException
      See Also:
      as of DOM Level 2
    • createAttributeNS

      public final Attr createAttributeNS​(String namespaceURI, String qualifiedName) throws DOMException
      Description copied from interface: Document
      Creates an attribute of the given qualified name and namespace URI.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      createAttributeNS in interface Document
      Parameters:
      namespaceURI -
      qualifiedName -
      Returns:
      A new Attr object with the following attributes:
      Attribute Value
      Node.nodeName qualifiedName
      Node.namespaceURI namespaceURI
      Node.prefix prefix, extracted from qualifiedName, or null if there is no prefix
      Node.localName local name, extracted from qualifiedName
      Attr.name qualifiedName
      Node.nodeValue the empty string
      Throws:
      DOMException
      See Also:
      as of DOM Level 2
    • getElementsByTagNameNS

      public final NodeList getElementsByTagNameNS​(String namespaceURI, String localName)
      Description copied from interface: Document
      Returns a NodeList of all the Elements with a given local name and namespace URI in document order.
      Specified by:
      getElementsByTagNameNS in interface Document
      Specified by:
      getElementsByTagNameNS in interface Element
      Parameters:
      namespaceURI -
      localName -
      Returns:
      A new NodeList object containing all the matched Elements.
      See Also:
      as of DOM Level 2
    • getElementById

      public final Element getElementById​(String elementId)
      Description copied from interface: Document
      Returns the Element that has an ID attribute with the given value. If no such element exists, this returns null . If more than one element has an ID attribute with that value, what is returned is undefined.
      The DOM implementation is expected to use the attribute Attr.isId to determine if an attribute is of type ID.

      Note: Attributes with the name "ID" or "id" are not of type ID unless so defined.

      Specified by:
      getElementById in interface Document
      Parameters:
      elementId -
      Returns:
      The matching element or null if there is none.
      See Also:
      as of DOM Level 2
    • splitText

      public final Text splitText​(int offset) throws DOMException
      Description copied from interface: Text
      Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings. After being split, this node will contain all the content up to the offset point. A new node of the same type, which contains all the content at and after the offset point, is returned. If the original node had a parent node, the new node is inserted as the next sibling of the original node. When the offset is equal to the length of this node, the new node has no data.
      Specified by:
      splitText in interface Text
      Parameters:
      offset -
      Returns:
      The new node, of the same type as this node.
      Throws:
      DOMException
      See Also:
      Text
    • getData

      public final String getData() throws DOMException
      Description copied from interface: CharacterData
      The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a CharacterData node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString. In such cases, the user may call substringData to retrieve the data in appropriately sized pieces.
      Specified by:
      getData in interface CharacterData
      Specified by:
      getData in interface ProcessingInstruction
      Throws:
      DOMException
      See Also:
      CharacterData
    • setData

      public final void setData​(String data) throws DOMException
      Description copied from interface: CharacterData
      The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a CharacterData node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString. In such cases, the user may call substringData to retrieve the data in appropriately sized pieces.
      Specified by:
      setData in interface CharacterData
      Specified by:
      setData in interface ProcessingInstruction
      Parameters:
      data -
      Throws:
      DOMException
      See Also:
      CharacterData
    • getLength

      public final int getLength()
      Description copied from interface: CharacterData
      The number of 16-bit units that are available through data and the substringData method below. This may have the value zero, i.e., CharacterData nodes may be empty.
      Specified by:
      getLength in interface CharacterData
      See Also:
      CharacterData
    • substringData

      public final String substringData​(int offset, int count) throws DOMException
      Description copied from interface: CharacterData
      Extracts a range of data from the node.
      Specified by:
      substringData in interface CharacterData
      Parameters:
      offset -
      count -
      Returns:
      The specified substring. If the sum of offset and count exceeds the length, then all 16-bit units to the end of the data are returned.
      Throws:
      DOMException
      See Also:
      CharacterData
    • appendData

      public final void appendData​(String arg) throws DOMException
      Description copied from interface: CharacterData
      Append the string to the end of the character data of the node. Upon success, data provides access to the concatenation of data and the DOMString specified.
      Specified by:
      appendData in interface CharacterData
      Parameters:
      arg -
      Throws:
      DOMException
      See Also:
      CharacterData
    • insertData

      public final void insertData​(int offset, String arg) throws DOMException
      Description copied from interface: CharacterData
      Insert a string at the specified 16-bit unit offset.
      Specified by:
      insertData in interface CharacterData
      Parameters:
      offset -
      arg -
      Throws:
      DOMException
      See Also:
      CharacterData
    • deleteData

      public final void deleteData​(int offset, int count) throws DOMException
      Description copied from interface: CharacterData
      Remove a range of 16-bit units from the node. Upon success, data and length reflect the change.
      Specified by:
      deleteData in interface CharacterData
      Parameters:
      offset -
      count -
      Throws:
      DOMException
      See Also:
      CharacterData
    • replaceData

      public final void replaceData​(int offset, int count, String arg) throws DOMException
      Description copied from interface: CharacterData
      Replace the characters starting at the specified 16-bit unit offset with the specified string.
      Specified by:
      replaceData in interface CharacterData
      Parameters:
      offset -
      count -
      arg -
      Throws:
      DOMException
      See Also:
      CharacterData
    • getTagName

      public final String getTagName()
      Description copied from interface: Element
      The name of the element. If Node.localName is different from null, this attribute is a qualified name. For example, in:
       <elementExample id="demo"> ...
       </elementExample> , 
      tagName has the value "elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the tagName of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.
      Specified by:
      getTagName in interface Element
      See Also:
      Element
    • getAttribute

      public final String getAttribute​(String name)
      Description copied from interface: Element
      Retrieves an attribute value by name.
      Specified by:
      getAttribute in interface Element
      Parameters:
      name -
      Returns:
      The Attr value as a string, or the empty string if that attribute does not have a specified or default value.
      See Also:
      Element
    • setAttribute

      public final void setAttribute​(String name, String value) throws DOMException
      Description copied from interface: Element
      Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute.
      To set an attribute with a qualified name and namespace URI, use the setAttributeNS method.
      Specified by:
      setAttribute in interface Element
      Parameters:
      name -
      value -
      Throws:
      DOMException
      See Also:
      Element
    • removeAttribute

      public final void removeAttribute​(String name) throws DOMException
      Description copied from interface: Element
      Removes an attribute by name. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
      If no attribute with this name is found, this method has no effect.
      To remove an attribute by local name and namespace URI, use the removeAttributeNS method.
      Specified by:
      removeAttribute in interface Element
      Parameters:
      name -
      Throws:
      DOMException
      See Also:
      Element
    • getAttributeNode

      public final Attr getAttributeNode​(String name)
      Description copied from interface: Element
      Retrieves an attribute node by name.
      To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS method.
      Specified by:
      getAttributeNode in interface Element
      Parameters:
      name -
      Returns:
      The Attr node with the specified name ( nodeName) or null if there is no such attribute.
      See Also:
      Element
    • setAttributeNode

      public final Attr setAttributeNode​(Attr newAttr) throws DOMException
      Description copied from interface: Element
      Adds a new attribute node. If an attribute with that name ( nodeName) is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.
      To add a new attribute node with a qualified name and namespace URI, use the setAttributeNodeNS method.
      Specified by:
      setAttributeNode in interface Element
      Parameters:
      newAttr -
      Returns:
      If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise null is returned.
      Throws:
      DOMException
      See Also:
      Element
    • removeAttributeNode

      public final Attr removeAttributeNode​(Attr oldAttr) throws DOMException
      Description copied from interface: Element
      Removes the specified attribute node. If a default value for the removed Attr node is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
      Specified by:
      removeAttributeNode in interface Element
      Parameters:
      oldAttr -
      Returns:
      The Attr node that was removed.
      Throws:
      DOMException
      See Also:
      Element
    • hasAttributes

      public boolean hasAttributes()
      Introduced in DOM Level 2.
      Specified by:
      hasAttributes in interface Node
      Returns:
      Returns true if this node has any attributes, false otherwise.
    • normalize

      public final void normalize()
      Description copied from interface: Node
      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. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of the DOMConfiguration object attached to the Node.ownerDocument is true, this method will also fully normalize the characters of the Text nodes.

      Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

      Specified by:
      normalize in interface Node
      See Also:
      Element
    • getAttributeNS

      public final String getAttributeNS​(String namespaceURI, String localName)
      Description copied from interface: Element
      Retrieves an attribute value by local name and namespace URI.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      getAttributeNS in interface Element
      Parameters:
      namespaceURI -
      localName -
      Returns:
      The Attr value as a string, or the empty string if that attribute does not have a specified or default value.
      See Also:
      Element
    • setAttributeNS

      public final void setAttributeNS​(String namespaceURI, String qualifiedName, String value) throws DOMException
      Description copied from interface: Element
      Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNodeNS or setAttributeNode to assign it as the value of an attribute.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      setAttributeNS in interface Element
      Parameters:
      namespaceURI -
      qualifiedName -
      value -
      Throws:
      DOMException
      See Also:
      Element
    • removeAttributeNS

      public final void removeAttributeNS​(String namespaceURI, String localName) throws DOMException
      Description copied from interface: Element
      Removes an attribute by local name and namespace URI. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
      If no attribute with this local name and namespace URI is found, this method has no effect.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      removeAttributeNS in interface Element
      Parameters:
      namespaceURI -
      localName -
      Throws:
      DOMException
      See Also:
      Element
    • getAttributeNodeNS

      public final Attr getAttributeNodeNS​(String namespaceURI, String localName)
      Description copied from interface: Element
      Retrieves an Attr node by local name and namespace URI.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      getAttributeNodeNS in interface Element
      Parameters:
      namespaceURI -
      localName -
      Returns:
      The Attr node with the specified attribute local name and namespace URI or null if there is no such attribute.
      See Also:
      Element
    • setAttributeNodeNS

      public final Attr setAttributeNodeNS​(Attr newAttr) throws DOMException
      Description copied from interface: Element
      Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.
      Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.
      Specified by:
      setAttributeNodeNS in interface Element
      Parameters:
      newAttr -
      Returns:
      If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr node is returned, otherwise null is returned.
      Throws:
      DOMException
      See Also:
      Element
    • getName

      public final String getName()
      Description copied from interface: Attr
      Returns the name of this attribute. If Node.localName is different from null, this attribute is a qualified name.
      Specified by:
      getName in interface Attr
      See Also:
      Attr
    • getSpecified

      public final boolean getSpecified()
      Description copied from interface: Attr
      True if this attribute was explicitly given a value in the instance document, false otherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set to true. The implementation may handle attributes with default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
      Specified by:
      getSpecified in interface Attr
      See Also:
      Attr
    • getValue

      public final String getValue()
      Description copied from interface: Attr
      On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface.
      On setting, this creates a Text node with the unparsed contents of the string, i.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the method Element.setAttribute().
      Some specialized implementations, such as some [SVG 1.1] implementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting.
      Specified by:
      getValue in interface Attr
      See Also:
      Attr
    • setValue

      public final void setValue​(String value)
      Description copied from interface: Attr
      On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface.
      On setting, this creates a Text node with the unparsed contents of the string, i.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the method Element.setAttribute().
      Some specialized implementations, such as some [SVG 1.1] implementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting.
      Specified by:
      setValue in interface Attr
      Parameters:
      value -
      See Also:
      Attr
    • getOwnerElement

      public final Element getOwnerElement()
      Get the owner element of an attribute.
      Specified by:
      getOwnerElement in interface Attr
      See Also:
      as of DOM Level 2
    • adoptNode

      public Node adoptNode​(Node source) throws DOMException
      NEEDSDOC Method adoptNode NEEDSDOC @param source
      Specified by:
      adoptNode in interface Document
      Parameters:
      source - The node to move into this document.
      Returns:
      The adopted node, or null if this operation fails, such as when the source node comes from a different implementation.
      Throws:
      DOMException
    • getInputEncoding

      public String getInputEncoding()

      Based on the Document Object Model (DOM) Level 3 Core Specification of 07 April 2004..

      An attribute specifying, as part of the XML declaration, the encoding of this document. This is null when unspecified.

      Specified by:
      getInputEncoding in interface Document
      Since:
      DOM Level 3
    • getStrictErrorChecking

      public boolean getStrictErrorChecking()

      Based on the Document Object Model (DOM) Level 3 Core Specification of 07 April 2004..

      An attribute specifying whether errors checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException. In case of error, the behavior is undefined. This attribute is true by defaults.

      Specified by:
      getStrictErrorChecking in interface Document
      Since:
      DOM Level 3
    • setStrictErrorChecking

      public void setStrictErrorChecking​(boolean strictErrorChecking)

      Based on the Document Object Model (DOM) Level 3 Core Specification of 07 April 2004..

      An attribute specifying whether errors checking is enforced or not. When set to false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any DOMException. In case of error, the behavior is undefined. This attribute is true by defaults.

      Specified by:
      setStrictErrorChecking in interface Document
      Since:
      DOM Level 3 NEEDSDOC @param strictErrorChecking
    • setUserData

      public Object setUserData​(String key, Object data, UserDataHandler handler)
      Description copied from interface: Node
      Associate an object to a key on this node. The object can later be retrieved from this node by calling getUserData with the same key.
      Specified by:
      setUserData in interface Node
      Parameters:
      key - The key to associate the object to.
      data - The object to associate to the given key, or null to remove any existing association to that key.
      handler - The handler to associate to that key, or null.
      Returns:
      Returns the DOMUserData previously associated to the given key on this node, or null if there was none.
    • getUserData

      public Object getUserData​(String key)
      Retrieves the object associated to a key on a this node. The object must first have been set to this node by calling setUserData with the same key.
      Specified by:
      getUserData in interface Node
      Parameters:
      key - The key the object is associated to.
      Returns:
      Returns the DOMObject associated to the given key on this node, or null if there was none.
      Since:
      DOM Level 3
    • getFeature

      public Object getFeature​(String feature, String version)
      This method returns a specialized object which implements the specialized APIs of the specified feature and version. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
      Specified by:
      getFeature in interface Node
      Parameters:
      feature - The name of the feature requested (case-insensitive).
      version - This is the version number of the feature to test. If the version is null or the empty string, supporting any version of the feature will cause the method to return an object that supports at least one version of the feature.
      Returns:
      Returns an object which implements the specialized APIs of the specified feature and version, if any, or null if there is no object which implements interfaces associated with that feature. If the DOMObject returned by this method implements the Node interface, it must delegate to the primary core Node and not return results inconsistent with the primary core Node such as attributes, childNodes, etc.
      Since:
      DOM Level 3
    • isEqualNode

      public boolean isEqualNode​(Node arg)
      Tests whether two nodes are equal.
      This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested with Node.isSameNode. All nodes that are the same will also be equal, though the reverse may not be true.
      Two nodes are equal if and only if the following conditions are satisfied: The two nodes are of the same type.The following string attributes are equal: nodeName, localName, namespaceURI, prefix, nodeValue , baseURI. This is: they are both null, or they have the same length and are character for character identical. The attributes NamedNodeMaps are equal. This is: they are both null, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index.The childNodes NodeLists are equal. This is: they are both null, or they have the same length and contain equal nodes at the same index. This is true for Attr nodes as for any other type of node. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared.
      For two DocumentType nodes to be equal, the following conditions must also be satisfied: The following string attributes are equal: publicId, systemId, internalSubset.The entities NamedNodeMaps are equal.The notations NamedNodeMaps are equal.
      On the other hand, the following do not affect equality: the ownerDocument attribute, the specified attribute for Attr nodes, the isWhitespaceInElementContent attribute for Text nodes, as well as any user data or event listeners registered on the nodes.
      Specified by:
      isEqualNode in interface Node
      Parameters:
      arg - The node to compare equality with.
      deep - If true, recursively compare the subtrees; if false, compare only the nodes themselves (and its attributes, if it is an Element).
      Returns:
      If the nodes, and possibly subtrees are equal, true otherwise false.
      Since:
      DOM Level 3
    • lookupNamespaceURI

      public String lookupNamespaceURI​(String specifiedPrefix)
      DOM Level 3: Look up the namespace URI associated to the given prefix, starting from this node. Use lookupNamespaceURI(null) to lookup the default namespace
      Specified by:
      lookupNamespaceURI in interface Node
      Parameters:
      namespaceURI -
      Returns:
      th URI for the namespace
      Since:
      DOM Level 3
    • isDefaultNamespace

      public boolean isDefaultNamespace​(String namespaceURI)
      DOM Level 3: This method checks if the specified namespaceURI is the default namespace or not.
      Specified by:
      isDefaultNamespace in interface Node
      Parameters:
      namespaceURI - The namespace URI to look for.
      Returns:
      true if the specified namespaceURI is the default namespace, false otherwise.
      Since:
      DOM Level 3
    • lookupPrefix

      public String lookupPrefix​(String namespaceURI)
      DOM Level 3: Look up the prefix associated to the given namespace URI, starting from this node.
      Specified by:
      lookupPrefix in interface Node
      Parameters:
      namespaceURI -
      Returns:
      the prefix for the namespace
    • isSameNode

      public boolean isSameNode​(Node other)
      Returns whether this node is the same node as the given one.
      This method provides a way to determine whether two Node references returned by the implementation reference the same object. When two Node references are references to the same object, even if through a proxy, the references may be used completely interchangably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.
      Specified by:
      isSameNode in interface Node
      Parameters:
      other - The node to test against.
      Returns:
      Returns true if the nodes are the same, false otherwise.
      Since:
      DOM Level 3
    • setTextContent

      public void setTextContent​(String textContent) throws DOMException
      This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a single Text node containing the string this attribute is set to. On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed, the returned string does not contain the element content whitespaces . Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content.
      The string returned is made of the text content of this node depending on its type, as defined below:
      Node type Content
      ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes
      ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValue
      DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null
      Specified by:
      setTextContent in interface Node
      Throws:
      DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
      DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
      Since:
      DOM Level 3
    • getTextContent

      public String getTextContent() throws DOMException
      This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a single Text node containing the string this attribute is set to. On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed, the returned string does not contain the element content whitespaces . Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content.
      The string returned is made of the text content of this node depending on its type, as defined below:
      Node type Content
      ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes
      ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValue
      DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null
      Specified by:
      getTextContent in interface Node
      Throws:
      DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
      DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
      Since:
      DOM Level 3
    • compareDocumentPosition

      public short compareDocumentPosition​(Node other) throws DOMException
      Compares a node with this node with regard to their position in the document.
      Specified by:
      compareDocumentPosition in interface Node
      Parameters:
      other - The node to compare against this node.
      Returns:
      Returns how the given node is positioned relatively to this node.
      Throws:
      DOMException - NOT_SUPPORTED_ERR: when the compared nodes are from different DOM implementations that do not coordinate to return consistent implementation-specific results.
      Since:
      DOM Level 3
    • getBaseURI

      public String getBaseURI()
      The absolute base URI of this node or null if undefined. This value is computed according to . However, when the Document supports the feature "HTML" , the base URI is computed using first the value of the href attribute of the HTML BASE element if any, and the value of the documentURI attribute from the Document interface otherwise.
      When the node is an Element, a Document or a a ProcessingInstruction, this attribute represents the properties [base URI] defined in . When the node is a Notation, an Entity, or an EntityReference, this attribute represents the properties [declaration base URI] in the . How will this be affected by resolution of relative namespace URIs issue?It's not.Should this only be on Document, Element, ProcessingInstruction, Entity, and Notation nodes, according to the infoset? If not, what is it equal to on other nodes? Null? An empty string? I think it should be the parent's.No.Should this be read-only and computed or and actual read-write attribute?Read-only and computed (F2F 19 Jun 2000 and teleconference 30 May 2001).If the base HTML element is not yet attached to a document, does the insert change the Document.baseURI? Yes. (F2F 26 Sep 2001)
      Specified by:
      getBaseURI in interface Node
      Since:
      DOM Level 3
    • renameNode

      public Node renameNode​(Node n, String namespaceURI, String name) throws DOMException
      DOM Level 3 Renaming node
      Specified by:
      renameNode in interface Document
      Parameters:
      n - The node to rename.
      namespaceURI - The new namespace URI.
      name - The new qualified name.
      Returns:
      The renamed node. This is either the specified node or the new node that was created to replace the specified node.
      Throws:
      DOMException - NOT_SUPPORTED_ERR: Raised when the type of the specified node is neither ELEMENT_NODE nor ATTRIBUTE_NODE, or if the implementation does not support the renaming of the document element.
      INVALID_CHARACTER_ERR: Raised if the new qualified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
      WRONG_DOCUMENT_ERR: Raised when the specified node was created from a different document than this document.
      NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from " http://www.w3.org/XML/1998/namespace" [XML Namespaces] . Also raised, when the node being renamed is an attribute, if the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/".
    • normalizeDocument

      public void normalizeDocument()
      DOM Level 3 Normalize document.
      Specified by:
      normalizeDocument in interface Document
    • getDomConfig

      public DOMConfiguration getDomConfig()
      The configuration used when Document.normalizeDocument is invoked.
      Specified by:
      getDomConfig in interface Document
      Since:
      DOM Level 3
    • setDocumentURI

      public void setDocumentURI​(String documentURI)
      DOM Level 3
      Specified by:
      setDocumentURI in interface Document
    • getDocumentURI

      public String getDocumentURI()
      DOM Level 3 The location of the document or null if undefined.
      Beware that when the Document supports the feature "HTML" , the href attribute of the HTML BASE element takes precedence over this attribute.
      Specified by:
      getDocumentURI in interface Document
      Since:
      DOM Level 3
    • getActualEncoding

      public String getActualEncoding()
      DOM Level 3 An attribute specifying the actual encoding of this document. This is null otherwise.
      This attribute represents the property [character encoding scheme] defined in .
      Since:
      DOM Level 3
    • setActualEncoding

      public void setActualEncoding​(String value)
      DOM Level 3 An attribute specifying the actual encoding of this document. This is null otherwise.
      This attribute represents the property [character encoding scheme] defined in .
      Since:
      DOM Level 3
    • replaceWholeText

      public Text replaceWholeText​(String content) throws DOMException
      DOM Level 3
      Specified by:
      replaceWholeText in interface Text
      Parameters:
      content - The content of the replacing Text node.
      Returns:
      The Text node created with the specified content.
      Throws:
      DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if one of the Text nodes being replaced is readonly.
    • getWholeText

      public String getWholeText()
      DOM Level 3 Returns all text of Text nodes logically-adjacent text nodes to this node, concatenated in document order.
      Specified by:
      getWholeText in interface Text
      Since:
      DOM Level 3
    • isElementContentWhitespace

      public boolean isElementContentWhitespace()
      DOM Level 3 Returns whether this text node contains whitespace in element content, often abusively called "ignorable whitespace".
      Specified by:
      isElementContentWhitespace in interface Text
    • setIdAttribute

      public void setIdAttribute​(boolean id)
      NON-DOM: set the type of this attribute to be ID type.
      Parameters:
      id -
    • setIdAttribute

      public void setIdAttribute​(String name, boolean makeId)
      DOM Level 3: register the given attribute node as an ID attribute
      Specified by:
      setIdAttribute in interface Element
      Parameters:
      name - The name of the attribute.
      makeId - Whether the attribute is a of type ID.
    • setIdAttributeNode

      public void setIdAttributeNode​(Attr at, boolean makeId)
      DOM Level 3: register the given attribute node as an ID attribute
      Specified by:
      setIdAttributeNode in interface Element
      Parameters:
      at - The attribute node.
      makeId - Whether the attribute is a of type ID.
    • setIdAttributeNS

      public void setIdAttributeNS​(String namespaceURI, String localName, boolean makeId)
      DOM Level 3: register the given attribute node as an ID attribute
      Specified by:
      setIdAttributeNS in interface Element
      Parameters:
      namespaceURI - The namespace URI of the attribute.
      localName - The local name of the attribute.
      makeId - Whether the attribute is a of type ID.
    • getSchemaTypeInfo

      public TypeInfo getSchemaTypeInfo()
      Description copied from interface: Element
      The type information associated with this element.
      Specified by:
      getSchemaTypeInfo in interface Attr
      Specified by:
      getSchemaTypeInfo in interface Element
    • isId

      public boolean isId()
      Description copied from interface: Attr
      Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, the ownerElement of this attribute can be retrieved using the method Document.getElementById . The implementation could use several ways to determine if an attribute node is known to contain an identifier:
      • If validation occurred using an XML Schema [XML Schema Part 1] while loading the document or while invoking Document.normalizeDocument(), the post-schema-validation infoset contributions (PSVI contributions) values are used to determine if this attribute is a schema-determined ID attribute using the schema-determined ID definition in [XPointer] .
      • If validation occurred using a DTD while loading the document or while invoking Document.normalizeDocument(), the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID attribute using the DTD-determined ID definition in [XPointer] .
      • from the use of the methods Element.setIdAttribute(), Element.setIdAttributeNS(), or Element.setIdAttributeNode(), i.e. it is an user-determined ID attribute;

        Note: XPointer framework (see section 3.2 in [XPointer] ) consider the DOM user-determined ID attribute as being part of the XPointer externally-determined ID definition.

      • using mechanisms that are outside the scope of this specification, it is then an externally-determined ID attribute. This includes using schema languages different from XML schema and DTD.

      If validation occurred while invoking Document.normalizeDocument(), all user-determined ID attributes are reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if the Attr.schemaTypeInfo attribute contains an ID type, isId will always return true.
      Specified by:
      isId in interface Attr
    • getXmlEncoding

      public String getXmlEncoding()
      Description copied from interface: Document
      An attribute specifying, as part of the XML declaration, the encoding of this document. This is null when unspecified or when it is not known, such as when the Document was created in memory.
      Specified by:
      getXmlEncoding in interface Document
    • setXmlEncoding

      public void setXmlEncoding​(String xmlEncoding)
    • getXmlStandalone

      public boolean getXmlStandalone()
      Description copied from interface: Document
      An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false when unspecified.

      Note: No verification is done on the value when setting this attribute. Applications should use Document.normalizeDocument() with the "validate" parameter to verify if the value matches the validity constraint for standalone document declaration as defined in [XML 1.0].

      Specified by:
      getXmlStandalone in interface Document
    • setXmlStandalone

      public void setXmlStandalone​(boolean xmlStandalone) throws DOMException
      Description copied from interface: Document
      An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false when unspecified.

      Note: No verification is done on the value when setting this attribute. Applications should use Document.normalizeDocument() with the "validate" parameter to verify if the value matches the validity constraint for standalone document declaration as defined in [XML 1.0].

      Specified by:
      setXmlStandalone in interface Document
      Throws:
      DOMException - NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature.
    • getXmlVersion

      public String getXmlVersion()
      Description copied from interface: Document
      An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is "1.0". If this document does not support the "XML" feature, the value is always null. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invoke Document.normalizeDocument() in order to check for invalid characters in the Nodes that are already part of this Document.
      DOM applications may use the DOMImplementation.hasFeature(feature, version) method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports [XML 1.0]. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports [XML 1.1]. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification. Document objects supporting a version of the "XMLVersion" feature must not raise a NOT_SUPPORTED_ERR exception for the same version number when using Document.xmlVersion.
      Specified by:
      getXmlVersion in interface Document
    • setXmlVersion

      public void setXmlVersion​(String xmlVersion) throws DOMException
      Description copied from interface: Document
      An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is "1.0". If this document does not support the "XML" feature, the value is always null. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invoke Document.normalizeDocument() in order to check for invalid characters in the Nodes that are already part of this Document.
      DOM applications may use the DOMImplementation.hasFeature(feature, version) method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports [XML 1.0]. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports [XML 1.1]. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification. Document objects supporting a version of the "XMLVersion" feature must not raise a NOT_SUPPORTED_ERR exception for the same version number when using Document.xmlVersion.
      Specified by:
      setXmlVersion in interface Document
      Throws:
      DOMException - NOT_SUPPORTED_ERR: Raised if the version is set to a value that is not supported by this Document or if this document does not support the "XML" feature.