Package org.eclipse.lemminx.dom

## Class DOMNode

- java.lang.Object
- - org.eclipse.lemminx.dom.DOMNode

All Implemented Interfaces:
  `DOMRange`, `Node`

Direct Known Subclasses:
  `DOMAttr`, `DOMCharacterData`, `DOMDocument`, `DOMElement`, `DTDDeclNode`

    public abstract class DOMNode
    extends Object
    implements Node, DOMRange

DOM node.

### Field Summary

Fields
`static short` `DTD_ATT_LIST_NODE` The node is a `DTD Attribute List`.
`static short` `DTD_DECL_NODE` The node is a generic `DTD Decl Node`.
`static short` `DTD_ELEMENT_DECL_NODE` The node is a `DTD Element Declaration`.
`static short` `DTD_ENTITY_DECL_NODE` The node is a `DTD Entity Declaraction`.
`static short` `DTD_NOTATION_DECL` The node is a `DTD Notation Declaraction`.
`static int` `NULL_VALUE` Null value used for offset.

### Fields inherited from interface org.w3c.dom.Node

`ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

### Constructor Summary

Constructors
`DOMNode​(int start, int end)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addChild​(DOMNode child)` Add node child and set child.parent to `this`
`Node` `appendChild​(Node newChild)`
`Node` `cloneNode​(boolean deep)`
`short` `compareDocumentPosition​(Node other)`
`DOMAttr` `findAttrAt​(int offset)`
`static DOMAttr` `findAttrAt​(DOMNode node, int offset)`
`DTDDeclParameter` `findDTDDeclParameterAt​(int offset)`
`static DTDDeclParameter` `findDTDDeclParameterAt​(DOMNode node, int offset)`
`DOMNode` `findNodeAt​(int offset)`
`DOMNode` `findNodeBefore​(int offset)` Returns the node before
`static DOMNode` `findNodeOrAttrAt​(DOMDocument document, int offset)`
`static DOMText` `findTextAt​(DOMNode node, int offset)`
`String` `getAttribute​(String name)`
`DOMAttr` `getAttributeAtIndex​(int index)` Returns the attribute at the given index, the order is how the attributes appear in the document.
`DOMAttr` `getAttributeNode​(String name)`
`DOMAttr` `getAttributeNode​(String prefix, String suffix)` Returns the attribute that matches the given name.
`List<DOMAttr>` `getAttributeNodes()`
`NamedNodeMap` `getAttributes()`
`String` `getBaseURI()`
`DOMNode` `getChild​(int index)` Returns node child at the given index.
`NodeList` `getChildNodes()`
`List<DOMNode>` `getChildren()` Returns the node children.
`List<DOMNode>` `getChildrenWithAttributeValue​(String name, String value)` Returns a list of children, each having an attribute called name, with a value of value
`int` `getEnd()` Returns the end offset of the node.
`Object` `getFeature​(String arg0, String arg1)`
`DOMNode` `getFirstChild()`
`DOMNode` `getLastChild()`
`String` `getLocalName()`
`String` `getNamespaceURI()`
`DOMNode` `getNextSibling()`
`String` `getNodeValue()`
`DOMElement` `getOrphanEndElement​(int offset, String tagName)` Returns the orphan end element after the given offset which matches the given tagName and null otherwise.
`DOMElement` `getOrphanEndElement​(int offset, String tagName, boolean anyOrphan)` Returns the orphan end element after the given offset which matches the given tagName and the first orphan end element otherwise and null otherwise.
`DOMDocument` `getOwnerDocument()` Returns the owner document and null otherwise.
`DOMElement` `getParentElement()`
`DOMNode` `getParentNode()`
`String` `getPrefix()`
`DOMNode` `getPreviousNonTextSibling()`
`DOMNode` `getPreviousSibling()`
`int` `getStart()` Returns the start offset of the node.
`String` `getTextContent()`
`Object` `getUserData​(String arg0)`
`boolean` `hasAttribute​(String name)`
`boolean` `hasAttributes()`
`boolean` `hasChildNodes()`
`Node` `insertBefore​(Node arg0, Node arg1)`
`boolean` `isAttribute()`
`boolean` `isCDATA()`
`boolean` `isCharacterData()`
`boolean` `isChildOfOwnerDocument()`
`boolean` `isClosed()`
`boolean` `isComment()`
`boolean` `isDefaultNamespace​(String arg0)`
`boolean` `isDoctype()`
`boolean` `isDTDAttListDecl()`
`boolean` `isDTDElementDecl()`
`boolean` `isDTDEntityDecl()`
`boolean` `isDTDNotationDecl()`
`boolean` `isElement()`
`boolean` `isEqualNode​(Node arg0)`
`boolean` `isGenericDTDDecl()`
`static boolean` `isIncluded​(int start, int end, int offset)`
`static boolean` `isIncluded​(DOMRange node, int offset)` Returns true if the node included the given offset and false otherwise.
`boolean` `isOwnerDocument()`
`boolean` `isProcessingInstruction()`
`boolean` `isProlog()`
`boolean` `isSameNode​(Node arg0)`
`boolean` `isSupported​(String arg0, String arg1)`
`boolean` `isText()`
`String` `lookupNamespaceURI​(String arg0)`
`String` `lookupPrefix​(String arg0)`
`void` `normalize()`
`Node` `removeChild​(Node arg0)`
`Node` `replaceChild​(Node arg0, Node arg1)`
`void` `setAttribute​(String name, String value)`
`void` `setAttributeNode​(DOMAttr attr)`
`void` `setNodeValue​(String arg0)`
`void` `setPrefix​(String arg0)`
`void` `setTextContent​(String arg0)`
`Object` `setUserData​(String arg0, Object arg1, UserDataHandler arg2)`
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.w3c.dom.Node

`getNodeName, getNodeType`

### Field Detail

#### NULL_VALUE

    public static final int NULL_VALUE

Null value used for offset.

See Also:
  Constant Field Values

#### DTD_ELEMENT_DECL_NODE

    public static final short DTD_ELEMENT_DECL_NODE

The node is a `DTD Element Declaration`.

See Also:
  Constant Field Values

#### DTD_ATT_LIST_NODE

    public static final short DTD_ATT_LIST_NODE

The node is a `DTD Attribute List`.

See Also:
  Constant Field Values

#### DTD_ENTITY_DECL_NODE

    public static final short DTD_ENTITY_DECL_NODE

The node is a `DTD Entity Declaraction`.

See Also:
  Constant Field Values

#### DTD_NOTATION_DECL

    public static final short DTD_NOTATION_DECL

The node is a `DTD Notation Declaraction`.

See Also:
  Constant Field Values

#### DTD_DECL_NODE

    public static final short DTD_DECL_NODE

The node is a generic `DTD Decl Node`.

See Also:
  Constant Field Values

### Constructor Detail

#### DOMNode

    public DOMNode​(int start,
                   int end)

### Method Detail

#### getOwnerDocument

    public DOMDocument getOwnerDocument()

Returns the owner document and null otherwise.

Specified by:
  `getOwnerDocument` in interface `DOMRange`
Specified by:
  `getOwnerDocument` in interface `Node`
Returns:
  the owner document and null otherwise.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### findNodeBefore

    public DOMNode findNodeBefore​(int offset)

Returns the node before

#### findNodeAt

    public DOMNode findNodeAt​(int offset)

#### isIncluded

    public static boolean isIncluded​(DOMRange node,
                                     int offset)

Returns true if the node included the given offset and false otherwise.

Parameters:
  `node` -
  `offset` -
Returns:
  true if the node included the given offset and false otherwise.

#### isIncluded

    public static boolean isIncluded​(int start,
                                     int end,
                                     int offset)

#### findAttrAt

    public DOMAttr findAttrAt​(int offset)

#### findAttrAt

    public static DOMAttr findAttrAt​(DOMNode node,
                                     int offset)

#### findDTDDeclParameterAt

    public DTDDeclParameter findDTDDeclParameterAt​(int offset)

#### findDTDDeclParameterAt

    public static DTDDeclParameter findDTDDeclParameterAt​(DOMNode node,
                                                          int offset)

#### findTextAt

    public static DOMText findTextAt​(DOMNode node,
                                     int offset)

#### findNodeOrAttrAt

    public static DOMNode findNodeOrAttrAt​(DOMDocument document,
                                           int offset)

#### getAttributeNode

    public DOMAttr getAttributeNode​(String name)

#### getAttributeNode

    public DOMAttr getAttributeNode​(String prefix,
                                    String suffix)

Returns the attribute that matches the given name. If there is no namespace, set prefix to null.

#### getAttribute

    public String getAttribute​(String name)

#### getAttributeAtIndex

    public DOMAttr getAttributeAtIndex​(int index)

Returns the attribute at the given index, the order is how the attributes appear in the document.

Parameters:
  `index` - Starting at 0, index of attribute you want
Returns:

#### hasAttribute

    public boolean hasAttribute​(String name)

#### hasAttributes

    public boolean hasAttributes()

Specified by:
  `hasAttributes` in interface `Node`

#### setAttribute

    public void setAttribute​(String name,
                             String value)

#### setAttributeNode

    public void setAttributeNode​(DOMAttr attr)

#### getAttributeNodes

    public List<DOMAttr> getAttributeNodes()

#### getChildrenWithAttributeValue

    public List<DOMNode> getChildrenWithAttributeValue​(String name,
                                                       String value)

Returns a list of children, each having an attribute called name, with a value of value

Parameters:
  `name` - name of attribute
  `value` - value of attribute
Returns:
  list of children, each having a specified attribute name and value

#### getChildren

    public List<DOMNode> getChildren()

Returns the node children.

Returns:
  the node children.

#### addChild

    public void addChild​(DOMNode child)

Add node child and set child.parent to `this`

Parameters:
  `child` - the node child to add.

#### getChild

    public DOMNode getChild​(int index)

Returns node child at the given index.

Parameters:
  `index` -
Returns:
  node child at the given index.

#### isClosed

    public boolean isClosed()

#### getParentElement

    public DOMElement getParentElement()

#### isComment

    public boolean isComment()

#### isProcessingInstruction

    public boolean isProcessingInstruction()

#### isProlog

    public boolean isProlog()

#### isCDATA

    public boolean isCDATA()

#### isDoctype

    public boolean isDoctype()

#### isGenericDTDDecl

    public boolean isGenericDTDDecl()

#### isElement

    public boolean isElement()

#### isAttribute

    public boolean isAttribute()

#### isText

    public boolean isText()

#### isCharacterData

    public boolean isCharacterData()

#### isDTDElementDecl

    public boolean isDTDElementDecl()

#### isDTDAttListDecl

    public boolean isDTDAttListDecl()

#### isDTDEntityDecl

    public boolean isDTDEntityDecl()

#### isDTDNotationDecl

    public boolean isDTDNotationDecl()

#### isOwnerDocument

    public boolean isOwnerDocument()

#### isChildOfOwnerDocument

    public boolean isChildOfOwnerDocument()

#### getStart

    public int getStart()

Description copied from interface: `DOMRange`
Returns the start offset of the node.

Specified by:
  `getStart` in interface `DOMRange`
Returns:
  the start offset of the node.

#### getEnd

    public int getEnd()

Description copied from interface: `DOMRange`
Returns the end offset of the node.

Specified by:
  `getEnd` in interface `DOMRange`
Returns:
  the end offset of the node.

#### getLocalName

    public String getLocalName()

Specified by:
  `getLocalName` in interface `Node`

#### getParentNode

    public DOMNode getParentNode()

Specified by:
  `getParentNode` in interface `Node`

#### getFirstChild

    public DOMNode getFirstChild()

Specified by:
  `getFirstChild` in interface `Node`

#### getLastChild

    public DOMNode getLastChild()

Specified by:
  `getLastChild` in interface `Node`

#### getAttributes

    public NamedNodeMap getAttributes()

Specified by:
  `getAttributes` in interface `Node`

#### getChildNodes

    public NodeList getChildNodes()

Specified by:
  `getChildNodes` in interface `Node`

#### appendChild

    public Node appendChild​(Node newChild)
                     throws DOMException

Specified by:
  `appendChild` in interface `Node`
Throws:
  `DOMException`

#### cloneNode

    public Node cloneNode​(boolean deep)

Specified by:
  `cloneNode` in interface `Node`

#### compareDocumentPosition

    public short compareDocumentPosition​(Node other)
                                  throws DOMException

Specified by:
  `compareDocumentPosition` in interface `Node`
Throws:
  `DOMException`

#### getBaseURI

    public String getBaseURI()

Specified by:
  `getBaseURI` in interface `Node`

#### getFeature

    public Object getFeature​(String arg0,
                             String arg1)

Specified by:
  `getFeature` in interface `Node`

#### getNamespaceURI

    public String getNamespaceURI()

Specified by:
  `getNamespaceURI` in interface `Node`

#### getNextSibling

    public DOMNode getNextSibling()

Specified by:
  `getNextSibling` in interface `Node`

#### getNodeValue

    public String getNodeValue()
                        throws DOMException

Specified by:
  `getNodeValue` in interface `Node`
Throws:
  `DOMException`

#### getPrefix

    public String getPrefix()

Specified by:
  `getPrefix` in interface `Node`

#### getPreviousSibling

    public DOMNode getPreviousSibling()

Specified by:
  `getPreviousSibling` in interface `Node`

#### getPreviousNonTextSibling

    public DOMNode getPreviousNonTextSibling()

#### getOrphanEndElement

    public DOMElement getOrphanEndElement​(int offset,
                                          String tagName)

Returns the orphan end element after the given offset which matches the given tagName and null otherwise. The following sample sample with tagName=foo will returns the <\foo> orphan end element:

| <\foo>

Parameters:
  `offset` - the offset.
  `tagName` - the tag name.
Returns:
  the orphan end element after the given offset which matches the given tagName and null otherwise.

#### getOrphanEndElement

    public DOMElement getOrphanEndElement​(int offset,
                                          String tagName,
                                          boolean anyOrphan)

Returns the orphan end element after the given offset which matches the given tagName and the first orphan end element otherwise and null otherwise. The following sample sample with tagName=bar will returns the <\foo> orphan end element:

| <\foo>

Parameters:
  `offset` - the offset.
  `tagName` - the tag name.
  `anyOrphan` - true if any orphan should be returned and false otherwise.
Returns:
  the orphan end element after the given offset which matches the given tagName and the first orphan end element otherwise and null otherwise.

#### getTextContent

    public String getTextContent()
                          throws DOMException

Specified by:
  `getTextContent` in interface `Node`
Throws:
  `DOMException`

#### getUserData

    public Object getUserData​(String arg0)

Specified by:
  `getUserData` in interface `Node`

#### hasChildNodes

    public boolean hasChildNodes()

Specified by:
  `hasChildNodes` in interface `Node`

#### insertBefore

    public Node insertBefore​(Node arg0,
                             Node arg1)
                      throws DOMException

Specified by:
  `insertBefore` in interface `Node`
Throws:
  `DOMException`

#### isDefaultNamespace

    public boolean isDefaultNamespace​(String arg0)

Specified by:
  `isDefaultNamespace` in interface `Node`

#### isEqualNode

    public boolean isEqualNode​(Node arg0)

Specified by:
  `isEqualNode` in interface `Node`

#### isSameNode

    public boolean isSameNode​(Node arg0)

Specified by:
  `isSameNode` in interface `Node`

#### isSupported

    public boolean isSupported​(String arg0,
                               String arg1)

Specified by:
  `isSupported` in interface `Node`

#### lookupNamespaceURI

    public String lookupNamespaceURI​(String arg0)

Specified by:
  `lookupNamespaceURI` in interface `Node`

#### lookupPrefix

    public String lookupPrefix​(String arg0)

Specified by:
  `lookupPrefix` in interface `Node`

#### normalize

    public void normalize()

Specified by:
  `normalize` in interface `Node`

#### removeChild

    public Node removeChild​(Node arg0)
                     throws DOMException

Specified by:
  `removeChild` in interface `Node`
Throws:
  `DOMException`

#### replaceChild

    public Node replaceChild​(Node arg0,
                             Node arg1)
                      throws DOMException

Specified by:
  `replaceChild` in interface `Node`
Throws:
  `DOMException`

#### setNodeValue

    public void setNodeValue​(String arg0)
                      throws DOMException

Specified by:
  `setNodeValue` in interface `Node`
Throws:
  `DOMException`

#### setPrefix

    public void setPrefix​(String arg0)
                   throws DOMException

Specified by:
  `setPrefix` in interface `Node`
Throws:
  `DOMException`

#### setTextContent

    public void setTextContent​(String arg0)
                        throws DOMException

Specified by:
  `setTextContent` in interface `Node`
Throws:
  `DOMException`

#### setUserData

    public Object setUserData​(String arg0,
                              Object arg1,
                              UserDataHandler arg2)

Specified by:
  `setUserData` in interface `Node`