org.txt2xml.core
Class RegexDelimitedProcessor

java.lang.Object
  |
  +--org.txt2xml.core.Processor
        |
        +--org.txt2xml.core.AbstractRegexProcessor
              |
              +--org.txt2xml.core.RegexDelimitedProcessor

public class RegexDelimitedProcessor
extends AbstractRegexProcessor

Repeatedly matches sections of text delimited by a regex pattern. For example, when regex=',' this Processor will operate against "1,2,3" with the following matches: "1", "2", "3".

Author:
Steve Meyfroidt

Field Summary
protected  int matchEnd
           
protected  int matchStart
           
protected  int nextMatchFrom
           
 
Fields inherited from class org.txt2xml.core.AbstractRegexProcessor
matcher, pattern, regex
 
Fields inherited from class org.txt2xml.core.Processor
chars, handler, NULL_ATTRIBUTES, parent
 
Constructor Summary
RegexDelimitedProcessor()
           
 
Method Summary
protected  boolean findMatch()
          Find next match, updating state appropriately.
protected  java.lang.CharSequence getMatchedText()
          Override this!
protected  java.lang.CharSequence getRemainderText()
          Override this!
protected  void resetMatching()
          Called at start of Processor.generateXmlFragment(CharSequence, ContentHandler) to reset the state before starting a round of matching.
 
Methods inherited from class org.txt2xml.core.AbstractRegexProcessor
getRegex, setRegex
 
Methods inherited from class org.txt2xml.core.Processor
generateEndXmlElement, generateStartXmlElement, generateXmlElementCharacters, generateXmlFragment, getElement, getNextProcessor, getSubProcessor, setElement, setNextProcessor, setSubProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matchStart

protected int matchStart

matchEnd

protected int matchEnd

nextMatchFrom

protected int nextMatchFrom
Constructor Detail

RegexDelimitedProcessor

public RegexDelimitedProcessor()
Method Detail

findMatch

protected boolean findMatch()
Description copied from class: Processor
Find next match, updating state appropriately. Override this!

Specified by:
findMatch in class Processor
Returns:
true if got a match, else false.

getMatchedText

protected java.lang.CharSequence getMatchedText()
Description copied from class: Processor
Override this!

Specified by:
getMatchedText in class Processor
Returns:
CharSequence for text matched in last Processor.findMatch().

getRemainderText

protected java.lang.CharSequence getRemainderText()
Description copied from class: Processor
Override this!

Specified by:
getRemainderText in class Processor
Returns:
null because this repeating Processor completely consumes the text.

resetMatching

protected void resetMatching()
Description copied from class: Processor
Called at start of Processor.generateXmlFragment(CharSequence, ContentHandler) to reset the state before starting a round of matching. Override to prepare for a round of matching, eg RegexDelimitedProcessor resets the regex Matcher here.

Overrides:
resetMatching in class AbstractRegexProcessor


Copyright © 2002 Steve Meyfroidt. All Rights Reserved.