public class XMLBeginEndIterator<E> extends AbstractIterator<E>
matches()
).
The class ignores all other characters in the input Reader.
There are a few different ways to modify the output of the
XMLBeginEndIterator. One way is to ask it to keep internal tags;
if keepInternalTags
is set, then
<text>A<foo>B</text> will be printed as A<foo>B.
Another is to tell it to keep delimiting tags; in the above example,
<text> will be kept as well.
Finally, you can ask it to keep track of the nesting depth; the
ordinary behavior of this iterator is to close all tags with just
one close tag. This is incorrect XML behavior, but is kept in case
any code relies on it. If countDepth
is set, though,
the iterator keeps track of how much it has nested.Constructor and Description |
---|
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp) |
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp,
boolean keepInternalTags) |
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp,
boolean keepInternalTags,
boolean keepDelimitingTags) |
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp,
boolean keepInternalTags,
boolean keepDelimitingTags,
boolean countDepth) |
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp,
java.util.function.Function<java.lang.String,E> op,
boolean keepInternalTags) |
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp,
java.util.function.Function<java.lang.String,E> op,
boolean keepInternalTags,
boolean keepDelimitingTags) |
XMLBeginEndIterator(java.io.Reader in,
java.lang.String tagNameRegexp,
java.util.function.Function<java.lang.String,E> op,
boolean keepInternalTags,
boolean keepDelimitingTags,
boolean countDepth) |
Modifier and Type | Method and Description |
---|---|
static IteratorFromReaderFactory<java.lang.String> |
getFactory(java.lang.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<java.lang.String> |
getFactory(java.lang.String tag,
boolean keepInternalTags,
boolean keepDelimitingTags) |
static <E> IteratorFromReaderFactory<E> |
getFactory(java.lang.String tag,
java.util.function.Function<java.lang.String,E> op) |
static <E> IteratorFromReaderFactory<E> |
getFactory(java.lang.String tag,
java.util.function.Function<java.lang.String,E> op,
boolean keepInternalTags,
boolean keepDelimitingTags) |
boolean |
hasNext() |
static void |
main(java.lang.String[] args) |
E |
next() |
protected E |
parseString(java.lang.String s) |
remove
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp)
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp, boolean keepInternalTags)
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp, java.util.function.Function<java.lang.String,E> op, boolean keepInternalTags)
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp, boolean keepInternalTags, boolean keepDelimitingTags)
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp, boolean keepInternalTags, boolean keepDelimitingTags, boolean countDepth)
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp, java.util.function.Function<java.lang.String,E> op, boolean keepInternalTags, boolean keepDelimitingTags)
public XMLBeginEndIterator(java.io.Reader in, java.lang.String tagNameRegexp, java.util.function.Function<java.lang.String,E> op, boolean keepInternalTags, boolean keepDelimitingTags, boolean countDepth)
protected E parseString(java.lang.String s)
public boolean hasNext()
AbstractIterator
hasNext
in interface java.util.Iterator<E>
hasNext
in class AbstractIterator<E>
public E next()
AbstractIterator
next
in interface java.util.Iterator<E>
next
in class AbstractIterator<E>
public static IteratorFromReaderFactory<java.lang.String> getFactory(java.lang.String tag)
tag
- The tag the XMLBeginEndIterator will match onpublic static IteratorFromReaderFactory<java.lang.String> getFactory(java.lang.String tag, boolean keepInternalTags, boolean keepDelimitingTags)
public static <E> IteratorFromReaderFactory<E> getFactory(java.lang.String tag, java.util.function.Function<java.lang.String,E> op)
public static <E> IteratorFromReaderFactory<E> getFactory(java.lang.String tag, java.util.function.Function<java.lang.String,E> op, boolean keepInternalTags, boolean keepDelimitingTags)
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException