Package cdc.util.data
Interface Node
-
- All Known Implementing Classes:
AbstractChild,AbstractContentNode,Comment,Document,Element,Text
public interface NodeBase interface of data nodes.Nodes are organized as a tree.
Implementations of Node are:- Author:
- Damien Carbonne
-
-
Field Summary
Fields Modifier and Type Field Description static Predicate<Node>ANY_NODEA Node Predicate that always returntrue.static Comparator<Node>ELEMENT_NAME_AND_ATTRIBUTES_COMPARATORstatic Comparator<Node>ELEMENT_NAME_COMPARATORstatic Predicate<Node>IS_COMMENTA Node Predicate that returnstruewhen the node is a Comment.static Predicate<Node>IS_ELEMENTA Node Predicate that returnstruewhen the node is an Element.static Predicate<Node>IS_IGNORABLE_TEXTA Node Predicate that returnstruewhen the node is a Text that is ignorable.static Predicate<Node>IS_PURE_ELEMENTA Node Predicate that returnstruewhen the node is an Element that has no attributes and no children .static Predicate<Node>IS_TEXTA Node Predicate that returnstruewhen the node is a Text.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Nodeclone(boolean recurse)Return a clone of this node.booleandeepEquals(Node node)Return true when this node and its descendants equals other node hierarchy.DocumentgetDocument()static StringgetNameAndAttributes(Element element)StringgetQName()ElementgetRootElement()Returns the root element of this node.NodeTypegetType()
-
-
-
Field Detail
-
IS_COMMENT
static final Predicate<Node> IS_COMMENT
A Node Predicate that returnstruewhen the node is a Comment.
-
IS_ELEMENT
static final Predicate<Node> IS_ELEMENT
A Node Predicate that returnstruewhen the node is an Element.
-
IS_TEXT
static final Predicate<Node> IS_TEXT
A Node Predicate that returnstruewhen the node is a Text.
-
IS_PURE_ELEMENT
static final Predicate<Node> IS_PURE_ELEMENT
A Node Predicate that returnstruewhen the node is an Element that has no attributes and no children .
-
IS_IGNORABLE_TEXT
static final Predicate<Node> IS_IGNORABLE_TEXT
A Node Predicate that returnstruewhen the node is a Text that is ignorable.
-
ELEMENT_NAME_COMPARATOR
static final Comparator<Node> ELEMENT_NAME_COMPARATOR
-
ELEMENT_NAME_AND_ATTRIBUTES_COMPARATOR
static final Comparator<Node> ELEMENT_NAME_AND_ATTRIBUTES_COMPARATOR
-
-
Method Detail
-
getType
NodeType getType()
- Returns:
- The node type.
-
clone
Node clone(boolean recurse)
Return a clone of this node.- Parameters:
recurse- If true, also clone children nodes.- Returns:
- A clone of this node, and optionally its children.
-
deepEquals
boolean deepEquals(Node node)
Return true when this node and its descendants equals other node hierarchy.Parents are ignored.
- Parameters:
node- The other node to compare.- Returns:
- True when this node and other node have same hierarchies.
-
getDocument
Document getDocument()
- Returns:
- The document of this node, possibly null.
-
getRootElement
Element getRootElement()
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, possiblynull.- Returns:
- The root element of this node, possibly null.
-
getQName
String getQName()
- Returns:
- A string representation of this node. May be used for debug.
-
-