org.apache.shale.clay.parser
Class AttributeTokenizer

java.lang.Object
  extended by org.apache.shale.clay.parser.AttributeTokenizer

public class AttributeTokenizer
extends Object

Tokenizes a portion of the document for attributes. The complete document is passed by reference and new Token offsets are created for the name and value of the discovered attributes.


Constructor Summary
AttributeTokenizer(StringBuffer buffer, int beginOffset, int endOffset, int lineNumber, int lineBeginOffset)
           Overloaded constructor that is passed the complete document and the starting and ending offset of the node body within the document.
 
Method Summary
 Iterator iterator()
          Returns an instance of an Iterator that will enumerate attributes in the document where the attributes are represented by a AttributeTokenizer.AttributeEntry instance.
protected  org.apache.shale.clay.parser.AttributeTokenizer.TokenOffset nextToken(int startOffset, String endDelim, String otherDelim, boolean isKey)
           Returns the next Token given an startOffset and a endDelim.
protected  void parse(ArrayList tokenIndex)
           Builds an ArrayList of AttributeTokenizer.AttributeEntry instances identifying name and value pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeTokenizer

public AttributeTokenizer(StringBuffer buffer,
                          int beginOffset,
                          int endOffset,
                          int lineNumber,
                          int lineBeginOffset)

Overloaded constructor that is passed the complete document and the starting and ending offset of the node body within the document.

Parameters:
buffer - document
beginOffset - start index of node body in the document
endOffset - end index of node body in the document
lineNumber - line number of the node within the document
lineBeginOffset - index in the document that the line begins
Method Detail

parse

protected void parse(ArrayList tokenIndex)

Builds an ArrayList of AttributeTokenizer.AttributeEntry instances identifying name and value pairs.

Parameters:
tokenIndex - populated attribute offset of a beging node body

nextToken

protected org.apache.shale.clay.parser.AttributeTokenizer.TokenOffset nextToken(int startOffset,
                                                                                String endDelim,
                                                                                String otherDelim,
                                                                                boolean isKey)

Returns the next Token given an startOffset and a endDelim.

Parameters:
startOffset - begining offset in the document
endDelim - primary token delimiter
otherDelim - secondary token delimiter
isKey - looking for an attribute name not a value
Returns:
next token offset

iterator

public Iterator iterator()

Returns an instance of an Iterator that will enumerate attributes in the document where the attributes are represented by a AttributeTokenizer.AttributeEntry instance.

Returns:
returns a AttributeTokenizer.TokenIterator iterator.


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.