Class XPathTokenizer

java.lang.Object
  extended by XPathTokenizer

public class XPathTokenizer
extends java.lang.Object

Specialized StreamTokeniser to simplify parsing of an XPath expression to be split in parts


Field Summary
private  java.io.StreamTokenizer st
           
 
Constructor Summary
XPathTokenizer(java.io.Reader r)
          Set up the tokenizer over a Reader the only "interesting" tokens are [ ] / ' and "
XPathTokenizer(java.lang.String str)
          Create a tokenizer over a String
 
Method Summary
 java.lang.String getToken()
          Return the current token
 boolean hasNext()
          Check if there are any token left
 boolean isString()
          Check if current token is a string
static void main(java.lang.String[] args)
          Some unit testing of this class
 java.lang.String nextToken()
          Get a new token and return it as String
 java.lang.String skip(java.lang.String sym)
          Check if the current token is @sym and return the next one if this is not the case then raise an exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

st

private java.io.StreamTokenizer st
Constructor Detail

XPathTokenizer

XPathTokenizer(java.io.Reader r)
Set up the tokenizer over a Reader the only "interesting" tokens are [ ] / ' and "

Parameters:
r - reader to specialize

XPathTokenizer

XPathTokenizer(java.lang.String str)
Create a tokenizer over a String

Parameters:
str - the String to tokenize as an XPath
Method Detail

hasNext

public boolean hasNext()
Check if there are any token left

Returns:

isString

public boolean isString()
Check if current token is a string

Returns:

nextToken

public java.lang.String nextToken()
                           throws java.io.IOException
Get a new token and return it as String

Returns:
Throws:
java.io.IOException

getToken

public java.lang.String getToken()
Return the current token

Returns:

skip

public java.lang.String skip(java.lang.String sym)
                      throws java.io.IOException
Check if the current token is @sym and return the next one if this is not the case then raise an exception

Parameters:
sym - the token to check with
Returns:
the value of the next token
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
Some unit testing of this class

Parameters:
args -