Package cdc.util.data

Class Document

  • All Implemented Interfaces:
    Node, Parent

    public final class Document
    extends Object
    implements Parent
    XML like Document node.
    Author:
    Damien Carbonne
    • Constructor Detail

      • Document

        public Document()
    • Method Detail

      • getType

        public NodeType getType()
        Specified by:
        getType in interface Node
        Returns:
        The node type.
      • clone

        public Document clone​(boolean recurse)
        Description copied from interface: Node
        Return a clone of this node.
        Specified by:
        clone in interface Node
        Specified by:
        clone in interface Parent
        Parameters:
        recurse - If true, also clone children nodes.
        Returns:
        A clone of this node, and optionally its children.
      • deepEquals

        public boolean deepEquals​(Node node)
        Description copied from interface: Node
        Return true when this node and its descendants equals other node hierarchy.

        Parents are ignored.

        Specified by:
        deepEquals in interface Node
        Parameters:
        node - The other node to compare.
        Returns:
        True when this node and other node have same hierarchies.
      • getQName

        public String getQName()
        Specified by:
        getQName in interface Node
        Returns:
        A string representation of this node. May be used for debug.
      • getDocument

        public Document getDocument()
        Specified by:
        getDocument in interface Node
        Returns:
        The document of this node, possibly null.
      • getRootElement

        public Element getRootElement()
        Description copied from interface: Node
        Returns the root element of this node.

        If this node is a document, then this is its unique child element, possibly null.
        If this node is a child, then this is the highest ancestor that is an element, possibly null.

        Specified by:
        getRootElement in interface Node
        Returns:
        The root element of this node, possibly null.
      • getRootElement

        public static Element getRootElement​(Document document)
        Returns the root element of a document.

        If document is null, then null is returned.

        Parameters:
        document - The document (possibly null).
        Returns:
        The root element of document.
      • canAddChild

        public boolean canAddChild​(Child child)
        Description copied from interface: Parent
        Returns true when a child can be added.
        Specified by:
        canAddChild in interface Parent
        Parameters:
        child - The child
        Returns:
        true when child can be added.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object