com.thoughtworks.xstream.io.path
Class Path

java.lang.Object
  extended bycom.thoughtworks.xstream.io.path.Path

public class Path
extends java.lang.Object

Represents a path (subset of XPath) to a single node in the tree.

Two absolute paths can also be compared to calculate the relative path between them. A relative path can be applied to an absolute path to calculate another absolute path.

Note that the paths produced are XPath compliant, so can be read by other XPath engines. The following are examples of path expressions that the Path object supports:

Example

 Path a = new Path("/html/body/div/table[2]/tr[3]/td/div");
 Path b = new Path("/html/body/div/table[2]/tr[6]/td/form");

 Path relativePath = a.relativeTo(b); // produces: "../../../tr[6]/td/form"
 Path c = a.apply(relativePath); // same as Path b.
 

Author:
Joe Walnes
See Also:
PathTracker

Constructor Summary
Path(java.lang.String pathAsString)
           
Path(java.lang.String[] chunks)
           
 
Method Summary
 Path apply(Path relativePath)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isAncestor(Path child)
           
 Path relativeTo(Path that)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Path

public Path(java.lang.String pathAsString)

Path

public Path(java.lang.String[] chunks)
Method Detail

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

relativeTo

public Path relativeTo(Path that)

apply

public Path apply(Path relativePath)

isAncestor

public boolean isAncestor(Path child)


Joe Walnes, http://xstream.codehaus.org/