junit.extensions.xml.elements
Class TokenizeTagHandler

java.lang.Object
  extended byjunit.extensions.xml.elements.AbstractTagHandler
      extended byjunit.extensions.xml.elements.TokenizeTagHandler
All Implemented Interfaces:
XMLConstants

public class TokenizeTagHandler
extends AbstractTagHandler

Return the tokens of a string one at a time.

Title:

TokenizeTagHandler

Description:

The TokenizeTagHandler provides a mechanism for breaking up a string into pieces. The refid points to the string that will be broken up, each call to tokenize returns the token, and the remainder of the token string that can be used again in a subsequent call.

Attributes:

 id        - the string token to be returned [required]
 refid     - the string of tokens to separate [required]
 delimiter - the token separator [required]
 

Example:

If array contained "File>New" and your delimiter was ">". As in:
 
    <property name="array" value="File>New"/>
    <tokenize id="token" refid="array" delimiter=">"/>
    <!-- Now array="New" token="File" -->
    <tokenize id="token" refid="array" delimiter=">"/>
    <!-- Now array="" token="New" -->
 
 
The first call would return "File" in the token property and update the array to "New". The second call would return "New" and update the array to: "" Any subsequent call would return ""
Another example is to return the values of various fields of which some may be null. <property name="array" value="userid:*:Guest:::"/> <tokenize id="token" refid="array" delimiter=":"/> <!-- Now array="*:Guest:::" token="userid" --> <tokenize id="token" refid="array" delimiter=":"/> <!-- Now array="Guest:::" token="*" --> <tokenize id="token" refid="array" delimiter=":"/> <!-- Now array="::" token="Guest" --> <tokenize id="token" refid="array" delimiter=":"/> <!-- Now array=":" token="" --> <tokenize id="token" refid="array" delimiter=":"/> <!-- Now array="" token="" -->

Copyright: Copyright (c) 2004

Company: JFCUnit Sourceforge project


Field Summary
 
Fields inherited from class junit.extensions.xml.elements.AbstractTagHandler
 
Fields inherited from interface junit.extensions.xml.XMLConstants
ACTION, ACTUALOBJ, ACTUALREFID, ADD, ASSERTENABLED, ASSERTEQUALS, ASSERTNOTEQUALS, ASSERTNOTNULL, ASSERTNOTSAME, ASSERTNULL, ASSERTSAME, CALL, CASE, CHOOSE, CLASSNAME, COLUMN, CONFIRM, DEBUG, DEFAULT, DELIMITER, DIALOG, DUMP, ECHO, ENABLED, ENCODING, EVALUATE, EXPECTEDOBJ, EXPECTEDREFID, FAIL, FILE, FOCUS, FOREACH, ID, INDEX, JFCFILELOC, LESSTHAN, LISTITEM, LOG, MARK, MESSAGE, METHOD, MODE, NAME, OTHERWISE, PATHREFID, PROCEDURE, PROPERTY, RECURSIVE, REFID, RELATIVE, REMOVE, ROW, SAVE, STDERR, STDOUT, STOPWATCH, SUITE, SWITCH, TABLECELL, TAGHANDLERS, TAGNAME, TEST, TYPE, USERE, VALUE, WHEN, WHILE
 
Constructor Summary
TokenizeTagHandler(org.w3c.dom.Element element, IXMLTestCase testcase)
          Constructor.
 
Method Summary
 void processElement()
          Handle the XML processing of the tag.
 void validateElement()
          Make sure the appropriate tag and attributes are used.
 
Methods inherited from class junit.extensions.xml.elements.AbstractTagHandler
checkAtLeastOneRequiredAttribute, checkAtLeastOneRequiredAttribute, checkElementTagName, checkOneRequiredAttribute, checkOneRequiredAttribute, checkRequiredAttribute, checkRequiredAttribute, getBoolean, getBoolean, getBoolean, getBoolean, getElement, getInt, getInt, getLong, getLong, getPoint, getPoint, getString, getString, getString, getString, getTagName, getTest, getTestCase, getXMLTestCase, getXMLTestSuite, resolveVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenizeTagHandler

public TokenizeTagHandler(org.w3c.dom.Element element,
                          IXMLTestCase testcase)
Constructor.

Parameters:
element - Element to be created.
testcase - IXMLTestCase parent test case.
Method Detail

processElement

public void processElement()
                    throws XMLException
Handle the XML processing of the tag.

Specified by:
processElement in class AbstractTagHandler
Throws:
XMLException - may be thrown.

validateElement

public void validateElement()
                     throws XMLException
Make sure the appropriate tag and attributes are used.

Overrides:
validateElement in class AbstractTagHandler
Throws:
XMLException - upon failure to validate.


Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999