Class DOMNode

    • 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

      • 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)
      • 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.
      • cloneNode

        public Node cloneNode​(boolean deep)
        Specified by:
        cloneNode 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.
      • hasChildNodes

        public boolean hasChildNodes()
        Specified by:
        hasChildNodes 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
      • normalize

        public void normalize()
        Specified by:
        normalize in interface Node