Package org.custommonkey.xmlunit
Class XpathNodeTracker
- java.lang.Object
-
- org.custommonkey.xmlunit.XpathNodeTracker
-
- All Implemented Interfaces:
XMLConstants
public class XpathNodeTracker extends java.lang.Object implements XMLConstants
Tracks Nodes visited by the DifferenceEngine and converts that information into an Xpath-String to supply to the NodeDetail of a Difference instance
-
-
Field Summary
-
Fields inherited from interface org.custommonkey.xmlunit.XMLConstants
CLOSE_NODE, END_CDATA, END_COMMENT, END_PROCESSING_INSTRUCTION, OPEN_END_NODE, OPEN_START_NODE, START_CDATA, START_COMMENT, START_DOCTYPE, START_PROCESSING_INSTRUCTION, W3C_XML_SCHEMA_INSTANCE_NO_NAMESPACE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_INSTANCE_NS_URI, W3C_XML_SCHEMA_INSTANCE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_INSTANCE_TYPE_ATTR, W3C_XML_SCHEMA_NS_URI, XML_DECLARATION, XMLNS_ATTRIBUTE_URI, XMLNS_PREFIX, XPATH_ATTRIBUTE_IDENTIFIER, XPATH_CHARACTER_NODE_IDENTIFIER, XPATH_COMMENT_IDENTIFIER, XPATH_NODE_INDEX_END, XPATH_NODE_INDEX_START, XPATH_PROCESSING_INSTRUCTION_IDENTIFIER, XPATH_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description XpathNodeTracker()Simple constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearTrackedAttribute()Call after processing attributes of an element and turining to compare the child nodes.voidindent()Call before examining child nodes one level of indentation into DOMvoidoutdent()Call after examining child nodes, ie before returning back one level of indentation from DOMvoidpreloadChildList(java.util.List nodeList)Preload the items in a List by visiting each in turn Required for pieces of test XML whose node children can be visited out of sequence by a DifferenceEngine comparisonvoidpreloadNodeList(org.w3c.dom.NodeList nodeList)Preload the items in a NodeList by visiting each in turn Required for pieces of test XML whose node children can be visited out of sequence by a DifferenceEngine comparisonvoidreset()Clear state data.java.lang.StringtoXpathString()voidvisited(org.w3c.dom.Node node)Call when visiting a node whose xpath location needs trackingprotected voidvisitedAttribute(java.lang.String visited)protected voidvisitedNode(org.w3c.dom.Node visited, java.lang.String value)
-
-
-
Method Detail
-
reset
public void reset()
Clear state data. Call if required to reuse an existing instance.
-
indent
public void indent()
Call before examining child nodes one level of indentation into DOM
-
clearTrackedAttribute
public void clearTrackedAttribute()
Call after processing attributes of an element and turining to compare the child nodes.
-
outdent
public void outdent()
Call after examining child nodes, ie before returning back one level of indentation from DOM
-
visited
public void visited(org.w3c.dom.Node node)
Call when visiting a node whose xpath location needs tracking- Parameters:
node- the Node being visited
-
visitedNode
protected void visitedNode(org.w3c.dom.Node visited, java.lang.String value)
-
visitedAttribute
protected void visitedAttribute(java.lang.String visited)
-
preloadNodeList
public void preloadNodeList(org.w3c.dom.NodeList nodeList)
Preload the items in a NodeList by visiting each in turn Required for pieces of test XML whose node children can be visited out of sequence by a DifferenceEngine comparison- Parameters:
nodeList- the items to preload
-
preloadChildList
public void preloadChildList(java.util.List nodeList)
Preload the items in a List by visiting each in turn Required for pieces of test XML whose node children can be visited out of sequence by a DifferenceEngine comparison- Parameters:
nodeList- the items to preload
-
toXpathString
public java.lang.String toXpathString()
- Returns:
- the last visited node as an xpath-location String
-
-