Instructions on how to use the XPath (Version 1.0) implementation


created by CLaRK Development Team (info@bultreebank.org)
within BulTreeBank project (http://www.bultreebank.org)

It is assumed that the reader of this document is familiar with
the detailed description in: XPath_implementation.htm.

The package is situated in file: xpath.jar

In order the package to be built in an application it is necessary
this JAR file to be included in the classpath of the application
during its complaion and execution.

Here we give a simple examlpe of the package usage. The demo
program is in file: ValidateXP.java. It receives as an argument a 
string representing an XPath expression and produces a message
which says whether the expression is valid or not.

Here is the source of ValidateXP:
****************************
import org.bultreebank.clark.xpath.*; //include the XPath package

public class ValidateXP
{
   public static void main(String[] args)
   {
      if ((args == null) || (args.length != 1))
      //check the input arguments
      {
         System.out.println("XPath Validator usage:");
         System.out.println("   java ValidateXP <xpath_expression>");
         return;
      }
      try
      {
         MainXPath.compile(args[0]);  // try to parse the expression
         System.out.println("XPath expression '"+args[0]+"' is valid!");
      }
      catch(ParseException pe) // if error -> show error message
      {
         System.out.println("XPath expression '"+args[0]
                     +"' is NOT valid!\nError: "+pe.getMessage());
      }
   }
}
******************************

In order to compile this demo program you need to include in the
classpath the xpath.jar file. If the two files (ValidateXP and xpath.jar)
are in one directory the command can be:

     javac -classpath .;xpath.jar ValidateXP.java

This operation produces file ValidateXP.class which can be started with:

     java -classpath .;xpath.jar ValidateXP "<xpath_expression>"

Note: Here in the two commands the classpath is set to: the current 
directory (".") and the xpath.jar file.

Note: The separator symbol for the classpath entries (here ';') depends
on the specific Java mashine and operating system.



