edu.stanford.nlp.objectbank
Class XMLBeginEndIterator

java.lang.Object
  extended by edu.stanford.nlp.util.AbstractIterator
      extended by edu.stanford.nlp.objectbank.XMLBeginEndIterator
All Implemented Interfaces:
Iterator

public class XMLBeginEndIterator
extends AbstractIterator

A class which iterates over Strings occuring between the begin and end of a selected tag or tags. The element is specified by a regexp, matched against the name of the element (i.e., excluding the angle bracket characters) using matches()). The class ignores all other characters in the input Reader.

Author:
Teg Grenager (grenager@stanford.edu)

Constructor Summary
XMLBeginEndIterator(Reader in, String tagNameRegexp)
           
XMLBeginEndIterator(Reader in, String tagNameRegexp, boolean keepInternalTags)
           
XMLBeginEndIterator(Reader in, String tagNameRegexp, boolean keepInternalTags, boolean keepDelimitingTags)
           
XMLBeginEndIterator(Reader in, String tagNameRegexp, Function op, boolean keepInternalTags)
           
XMLBeginEndIterator(Reader in, String tagNameRegexp, Function op, boolean keepInternalTags, boolean keepDelimitingTags)
           
 
Method Summary
static IteratorFromReaderFactory getFactory(String tag)
          Returns a factory that vends BeginEndIterators that reads the contents of the given Reader, extracts text between the specified Strings, then returns the result.
static IteratorFromReaderFactory getFactory(String tag, boolean keepInternalTags, boolean keepDelimitingTags)
           
static IteratorFromReaderFactory getFactory(String tag, Function op)
           
static IteratorFromReaderFactory getFactory(String tag, Function op, boolean keepInternalTags, boolean keepDelimitingTags)
           
 boolean hasNext()
           
static void main(String[] args)
           
 Object next()
           
protected  Object parseString(String s)
           
 Object peek()
           
 
Methods inherited from class edu.stanford.nlp.util.AbstractIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLBeginEndIterator

public XMLBeginEndIterator(Reader in,
                           String tagNameRegexp)

XMLBeginEndIterator

public XMLBeginEndIterator(Reader in,
                           String tagNameRegexp,
                           boolean keepInternalTags)

XMLBeginEndIterator

public XMLBeginEndIterator(Reader in,
                           String tagNameRegexp,
                           Function op,
                           boolean keepInternalTags)

XMLBeginEndIterator

public XMLBeginEndIterator(Reader in,
                           String tagNameRegexp,
                           boolean keepInternalTags,
                           boolean keepDelimitingTags)

XMLBeginEndIterator

public XMLBeginEndIterator(Reader in,
                           String tagNameRegexp,
                           Function op,
                           boolean keepInternalTags,
                           boolean keepDelimitingTags)
Method Detail

parseString

protected Object parseString(String s)

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator
Specified by:
hasNext in class AbstractIterator

next

public Object next()
Specified by:
next in interface Iterator
Specified by:
next in class AbstractIterator

peek

public Object peek()

getFactory

public static IteratorFromReaderFactory getFactory(String tag)
Returns a factory that vends BeginEndIterators that reads the contents of the given Reader, extracts text between the specified Strings, then returns the result.

Parameters:
tag -

getFactory

public static IteratorFromReaderFactory getFactory(String tag,
                                                   boolean keepInternalTags,
                                                   boolean keepDelimitingTags)

getFactory

public static IteratorFromReaderFactory getFactory(String tag,
                                                   Function op)

getFactory

public static IteratorFromReaderFactory getFactory(String tag,
                                                   Function op,
                                                   boolean keepInternalTags,
                                                   boolean keepDelimitingTags)

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Stanford NLP Group