Package org.eclipse.lemminx.dom
Class DOMNode
java.lang.Object
org.eclipse.lemminx.dom.DOMNode
- Direct Known Subclasses:
DOMAttr,DOMCharacterData,DOMDocument,DOMElement,DTDDeclNode
DOM node.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortThe node is aDTD Attribute List.static final shortThe node is a genericDTD Decl Node.static final shortThe node is aDTD Element Declaration.static final shortThe node is aDTD Entity Declaraction.static final shortThe node is aDTD Notation Declaraction.static final intNull 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd node child and set child.parent tothisappendChild(Node newChild) cloneNode(boolean deep) shortcompareDocumentPosition(Node other) findAttrAt(int offset) static DOMAttrfindAttrAt(DOMNode node, int offset) findNodeAt(int offset) findNodeBefore(int offset) Returns the node beforestatic DOMNodefindNodeOrAttrAt(DOMDocument document, int offset) static DOMTextfindTextAt(DOMNode node, int offset) getAttribute(String name) getAttributeAtIndex(int index) Returns the attribute at the given index, the order is how the attributes appear in the document.getAttributeNode(String name) getAttributeNode(String prefix, String suffix) Returns the attribute that matches the given name.getChild(int index) Returns node child at the given index.Returns the node children.getChildrenWithAttributeValue(String name, String value) Returns a list of children, each having an attribute called name, with a value of valueintgetEnd()Returns the end offset of the node.getFeature(String arg0, String arg1) getOrphanEndElement(int offset, String tagName) Returns the orphan end element after the given offset which matches the given tagName and null otherwise.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.Returns the owner document and null otherwise.intgetStart()Returns the start offset of the node.getUserData(String arg0) booleanhasAttribute(String name) booleanbooleaninsertBefore(Node arg0, Node arg1) booleanbooleanisCDATA()booleanbooleanbooleanisClosed()booleanbooleanisDefaultNamespace(String arg0) booleanbooleanbooleanbooleanbooleanbooleanbooleanisEqualNode(Node arg0) booleanstatic booleanisIncluded(int start, int end, int offset) static booleanisIncluded(DOMRange node, int offset) Returns true if the node included the given offset and false otherwise.booleanbooleanbooleanisProlog()booleanisSameNode(Node arg0) booleanisSupported(String arg0, String arg1) booleanisText()lookupNamespaceURI(String arg0) lookupPrefix(String arg0) voidremoveChild(Node arg0) replaceChild(Node arg0, Node arg1) voidsetAttribute(String name, String value) voidsetAttributeNode(DOMAttr attr) voidsetNodeValue(String arg0) voidvoidsetTextContent(String arg0) setUserData(String arg0, Object arg1, UserDataHandler arg2) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.w3c.dom.Node
getNodeName, getNodeType
-
Field Details
-
NULL_VALUE
public static final int NULL_VALUENull value used for offset.- See Also:
-
DTD_ELEMENT_DECL_NODE
public static final short DTD_ELEMENT_DECL_NODEThe node is aDTD Element Declaration.- See Also:
-
DTD_ATT_LIST_NODE
public static final short DTD_ATT_LIST_NODEThe node is aDTD Attribute List.- See Also:
-
DTD_ENTITY_DECL_NODE
public static final short DTD_ENTITY_DECL_NODEThe node is aDTD Entity Declaraction.- See Also:
-
DTD_NOTATION_DECL
public static final short DTD_NOTATION_DECLThe node is aDTD Notation Declaraction.- See Also:
-
DTD_DECL_NODE
public static final short DTD_DECL_NODEThe node is a genericDTD Decl Node.- See Also:
-
-
Constructor Details
-
DOMNode
public DOMNode(int start, int end)
-
-
Method Details
-
getOwnerDocument
Returns the owner document and null otherwise.- Specified by:
getOwnerDocumentin interfaceDOMRange- Specified by:
getOwnerDocumentin interfaceNode- Returns:
- the owner document and null otherwise.
-
toString
-
findNodeBefore
Returns the node before -
findNodeAt
-
isIncluded
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
-
findAttrAt
-
findTextAt
-
findNodeOrAttrAt
-
getAttributeNode
-
getAttributeNode
Returns the attribute that matches the given name. If there is no namespace, set prefix to null. -
getAttribute
-
getAttributeAtIndex
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
-
hasAttributes
public boolean hasAttributes()- Specified by:
hasAttributesin interfaceNode
-
setAttribute
-
setAttributeNode
-
getAttributeNodes
-
getChildrenWithAttributeValue
Returns a list of children, each having an attribute called name, with a value of value- Parameters:
name- name of attributevalue- value of attribute- Returns:
- list of children, each having a specified attribute name and value
-
getChildren
Returns the node children.- Returns:
- the node children.
-
addChild
Add node child and set child.parent tothis- Parameters:
child- the node child to add.
-
getChild
Returns node child at the given index.- Parameters:
index-- Returns:
- node child at the given index.
-
isClosed
public boolean isClosed() -
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:DOMRangeReturns the start offset of the node. -
getEnd
public int getEnd()Description copied from interface:DOMRangeReturns the end offset of the node. -
getLocalName
- Specified by:
getLocalNamein interfaceNode
-
getParentNode
- Specified by:
getParentNodein interfaceNode
-
getFirstChild
- Specified by:
getFirstChildin interfaceNode
-
getLastChild
- Specified by:
getLastChildin interfaceNode
-
getAttributes
- Specified by:
getAttributesin interfaceNode
-
getChildNodes
- Specified by:
getChildNodesin interfaceNode
-
appendChild
- Specified by:
appendChildin interfaceNode- Throws:
DOMException
-
cloneNode
-
compareDocumentPosition
- Specified by:
compareDocumentPositionin interfaceNode- Throws:
DOMException
-
getBaseURI
- Specified by:
getBaseURIin interfaceNode
-
getFeature
- Specified by:
getFeaturein interfaceNode
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceNode
-
getNextSibling
- Specified by:
getNextSiblingin interfaceNode
-
getNodeValue
- Specified by:
getNodeValuein interfaceNode- Throws:
DOMException
-
getPrefix
-
getPreviousSibling
- Specified by:
getPreviousSiblingin interfaceNode
-
getPreviousNonTextSibling
-
getOrphanEndElement
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
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
- Specified by:
getTextContentin interfaceNode- Throws:
DOMException
-
getUserData
- Specified by:
getUserDatain interfaceNode
-
hasChildNodes
public boolean hasChildNodes()- Specified by:
hasChildNodesin interfaceNode
-
insertBefore
- Specified by:
insertBeforein interfaceNode- Throws:
DOMException
-
isDefaultNamespace
- Specified by:
isDefaultNamespacein interfaceNode
-
isEqualNode
- Specified by:
isEqualNodein interfaceNode
-
isSameNode
- Specified by:
isSameNodein interfaceNode
-
isSupported
- Specified by:
isSupportedin interfaceNode
-
lookupNamespaceURI
- Specified by:
lookupNamespaceURIin interfaceNode
-
lookupPrefix
- Specified by:
lookupPrefixin interfaceNode
-
normalize
public void normalize() -
removeChild
- Specified by:
removeChildin interfaceNode- Throws:
DOMException
-
replaceChild
- Specified by:
replaceChildin interfaceNode- Throws:
DOMException
-
setNodeValue
- Specified by:
setNodeValuein interfaceNode- Throws:
DOMException
-
setPrefix
- Specified by:
setPrefixin interfaceNode- Throws:
DOMException
-
setTextContent
- Specified by:
setTextContentin interfaceNode- Throws:
DOMException
-
setUserData
- Specified by:
setUserDatain interfaceNode
-