org.custommonkey.xmlunit

Class XpathNodeTracker

public class XpathNodeTracker extends 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

See Also: getXpathLocation Difference Difference

Constructor Summary
XpathNodeTracker()
Simple constructor
Method Summary
voidindent()
Call before examining child nodes one level of indentation into DOM
voidoutdent()
Call after examining child nodes, ie before returning back one level of indentation from DOM
voidpreloadNodeList(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
voidreset()
Clear state data.
StringtoXpathString()
voidvisited(Node node)
Call when visiting a node whose xpath location needs tracking
protected voidvisitedAttribute(String visited)
protected voidvisitedNode(Node visited, String value)

Constructor Detail

XpathNodeTracker

public XpathNodeTracker()
Simple constructor

Method Detail

indent

public void indent()
Call before examining child nodes one level of indentation into DOM

outdent

public void outdent()
Call after examining child nodes, ie before returning back one level of indentation from DOM

preloadNodeList

public void preloadNodeList(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

reset

public void reset()
Clear state data. Call if required to reuse an existing instance.

toXpathString

public String toXpathString()

Returns: the last visited node as an xpath-location String

visited

public void visited(Node node)
Call when visiting a node whose xpath location needs tracking

Parameters: node the Node being visited

visitedAttribute

protected void visitedAttribute(String visited)

visitedNode

protected void visitedNode(Node visited, String value)