com.oxygenxml.validate.nvdl
Class Path

java.lang.Object
  extended by com.oxygenxml.validate.nvdl.Path

 class Path
extends Object

Stores a NVDL/NRL path information. Parses a path string and returns a list of Path objects. This stores a single path that can optionally start with a / and contains a list of local names separated by /, like /path1/path2 or path1/path2.


Nested Class Summary
(package private) static class Path.ParseException
          Exception thrown in case we get errors parsing a path.
 
Field Summary
private static int AFTER_NAME
          After a local name.
private static int AFTER_SLASH
          After a slash.
private static int IN_NAME
          In a local name.
private  Vector names
          The list of local names that form the path.
private  boolean root
          Flag indicating wether the path starts with / or not.
private static int START
          Initial state.
 
Constructor Summary
Path(boolean root, Vector names)
          Constructor, creates a Path.
 
Method Summary
(package private)  Vector getNames()
          Get the local names list.
(package private)  boolean isRoot()
          Determines if the path starts with / or not.
static void main(String[] args)
          Main method, for test.
private static String makeName(String str, int start, int end)
          Extracts a name from a given string (path) from the specified start position to the specified end position.
(package private) static Vector parse(String str)
          Gets the list of Path from the path string.
 String toString()
          Get a string representation of this path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

root

private final boolean root
Flag indicating wether the path starts with / or not.


names

private final Vector names
The list of local names that form the path.


START

private static final int START
Initial state.

See Also:
Constant Field Values

IN_NAME

private static final int IN_NAME
In a local name.

See Also:
Constant Field Values

AFTER_NAME

private static final int AFTER_NAME
After a local name.

See Also:
Constant Field Values

AFTER_SLASH

private static final int AFTER_SLASH
After a slash.

See Also:
Constant Field Values
Constructor Detail

Path

Path(boolean root,
     Vector names)
Constructor, creates a Path.

Parameters:
root - Flag specifying wether the path starts with / or not.
names - The list of local names.
Method Detail

isRoot

boolean isRoot()
Determines if the path starts with / or not.

Returns:
true if the path starts with /.

getNames

Vector getNames()
Get the local names list.

Returns:
A vector with the local names.

toString

public String toString()
Get a string representation of this path. It can be either /name1/name2 or name1/name2.

Overrides:
toString in class Object

parse

static Vector parse(String str)
             throws Path.ParseException
Gets the list of Path from the path string. The path string can represent more paths separated by |.

Parameters:
str - The path string.
Returns:
A Vector with the determined Path objects.
Throws:
Path.ParseException - In case of invalid path expression.

makeName

private static String makeName(String str,
                               int start,
                               int end)
                        throws Path.ParseException
Extracts a name from a given string (path) from the specified start position to the specified end position. It also checks that the extracted name is a valid non qualified name (local name).

Parameters:
str - The path string.
start - The start position.
end - The end position.
Returns:
A string representing the extracted local name.
Throws:
Path.ParseException - In case of invalid local name.

main

public static void main(String[] args)
                 throws Path.ParseException
Main method, for test.

Parameters:
args - Command line arguments, the first argument is a path.
Throws:
Path.ParseException - In case the parsing fails.