Class XPathContext
java.lang.Object
org.xmlunit.diff.XPathContext
- All Implemented Interfaces:
Cloneable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDOM based implementation ofXPathContext.NodeInfo.static interfaceRepresentation of a node used byXPathContext. -
Constructor Summary
ConstructorsConstructorDescriptionStarts with an empty context.XPathContext(Map<String, String> prefix2uri) Starts with an empty context and a given namespace mapping.XPathContext(Map<String, String> prefix2uri, Node root) Starts with the context of an optional root node and an optional namespace mapping.XPathContext(Node root) Starts with the context of a root node. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(QName attribute) Adds knowledge about a single attribute of the current node.voidaddAttributes(Iterable<? extends QName> attributes) Adds knowledge about the current node's attributes.voidappendChildren(Iterable<? extends XPathContext.NodeInfo> children) Adds knowledge about the current node's children appending to the knowledge already present.clone()Creates a deep copy of this XPathContext.Stringifies the XPath of the current node's parent.getXPath()Stringifies the XPath of the current node.voidnavigateToAttribute(QName attribute) Moves from the current node to the given attribute.voidnavigateToChild(int index) Moves from the current node to the given child node.voidMoves back to the parent.voidsetChildren(Iterable<? extends XPathContext.NodeInfo> children) Adds knowledge about the current node's children replacing existing knowledge.
-
Constructor Details
-
XPathContext
public XPathContext()Starts with an empty context. -
XPathContext
Starts with the context of a root node.- Parameters:
root- the root node
-
XPathContext
-
XPathContext
-
-
Method Details
-
addAttributes
-
addAttribute
Adds knowledge about a single attribute of the current node.- Parameters:
attribute- attribute to add
-
setChildren
Adds knowledge about the current node's children replacing existing knowledge.- Parameters:
children- children to add
-
appendChildren
Adds knowledge about the current node's children appending to the knowledge already present.- Parameters:
children- children to add
-
getXPath
-
getParentXPath
Stringifies the XPath of the current node's parent.- Returns:
- parent's XPath
-
clone
Creates a deep copy of this XPathContext.