public class

Path

extends Object
java.lang.Object
   ↳ com.thoughtworks.xstream.io.path.Path

Class Overview

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:

  • /
  • /some/node
  • /a/b/c/b/a
  • /some[3]/node[2]/a
  • ../../../another[3]/node

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.
 

See Also

Summary

Public Constructors
Path(String pathAsString)
Path(String[] chunks)
Public Methods
Path apply(Path relativePath)
boolean equals(Object o)
int hashCode()
boolean isAncestor(Path child)
Path relativeTo(Path that)
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Path (String pathAsString)

public Path (String[] chunks)

Public Methods

public Path apply (Path relativePath)

public boolean equals (Object o)

public int hashCode ()

public boolean isAncestor (Path child)

public Path relativeTo (Path that)

public String toString ()