Class XpathNodeTracker

java.lang.Object
org.custommonkey.xmlunit.XpathNodeTracker
All Implemented Interfaces:
XMLConstants

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:
  • Constructor Details

    • XpathNodeTracker

      public XpathNodeTracker()
      Simple constructor
  • Method Details

    • 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(Node node)
      Call when visiting a node whose xpath location needs tracking
      Parameters:
      node - the Node being visited
    • visitedNode

      protected void visitedNode(Node visited, String value)
    • visitedAttribute

      protected void visitedAttribute(String visited)
    • 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
    • preloadChildList

      public void preloadChildList(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 String toXpathString()
      Returns:
      the last visited node as an xpath-location String