public class TagFilter
extends TokenFilter
Modifier and Type | Field and Description |
---|---|
private String |
attrName
Name of the current attribute
|
private int |
attrNameStart
Start position of the attribute name
|
private String |
elementName
Name of the last element we've started
|
private Token |
elementStart
Start position of insides of element def
|
private static Pattern |
followingEntityPat
Pattern used to detect entities stuck onto a token.
|
private boolean |
inAttrName
True when we're within an attribute name
|
private boolean |
inElement
True while we're processing inside an element definition
|
private boolean |
inEndTag
True while we're in an element end tag
|
private boolean |
inQuote
True when we're within a quoted attribute value
|
private int |
quoteStart
Position of initial quote mark
|
private char[] |
srcChars
The source text being tokenized
|
static Tester |
tester
Basic regression test
|
private LinkedList |
tokenQueue
Queued tokens
|
static String |
XML_TYPE
Type of returned 'element' tokens
|
Constructor and Description |
---|
TagFilter(TokenStream input,
String srcText)
Construct a token stream to mark XML elements.
|
Modifier and Type | Method and Description |
---|---|
private Token |
interpretEntityRef(String termText,
int startPos,
int endPos)
Subroutine that translates an entity reference to its corresponding
character token.
|
Token |
next()
Retrieve the next token in the stream.
|
private Token |
processNext(Token curToken)
Does most of the work of processing a token
|
public static final String XML_TYPE
private char[] srcChars
private boolean inElement
private String elementName
private boolean inEndTag
private Token elementStart
private boolean inQuote
private int quoteStart
private boolean inAttrName
private int attrNameStart
private String attrName
private LinkedList tokenQueue
private static final Pattern followingEntityPat
public static final Tester tester
public TagFilter(TokenStream input, String srcText)
input
- Input stream of tokens to processpublic Token next() throws IOException
next
in class TokenStream
IOException
private Token processNext(Token curToken)
curToken
- The token from the input streamprivate Token interpretEntityRef(String termText, int startPos, int endPos)
termText
- The entity string to interpret, sans & or ;startPos
- Starting text position for the new tokenendPos
- Ending text position for the new token