public class MXMLTokenizer extends Object implements IMXMLTokenizer, Closeable
Modifier and Type | Field and Description |
---|---|
protected MutablePrefixMap |
rootPrefixMap |
protected int |
startOffset
Start offset (for when you're parsing a section of the document that
doesn't start at the beginning)
|
protected MXMLToken |
xmlNSToken |
Constructor and Description |
---|
MXMLTokenizer() |
MXMLTokenizer(IFileSpecification specification) |
MXMLTokenizer(int startOffset)
Reparse constructor.
|
MXMLTokenizer(String path)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildTokenList(MXMLToken token,
List<MXMLToken> list)
Handles the addition of tokens to the internal token list.
|
void |
close() |
PrefixMap |
getPrefixMap()
If it exists, return the PrefixMap from the last parse
|
PrefixMap |
getRootTagPrefixMap()
Processes the given input and builds a
PrefixMap for the root tag found within this document |
List<ICompilerProblem> |
getTokenizationProblems()
Returns a collection of problems encountered while processing the given input
|
IMXMLToken[] |
getTokens(Reader reader)
Returns an array of
IMXMLToken objects for a given range of text represented by a Reader |
IMXMLToken[] |
getTokens(String range)
Returns an array of
IMXMLToken objects for a given range of text represented by a String |
boolean |
hasTokenizationProblems()
Determines if the the tokenizer has encountered any problems as it lexed the given input
|
static void |
main(String[] args) |
MXMLToken |
nextToken()
Returns the next token that can be produced from the given input
|
List<MXMLToken> |
parseTokens(Reader input)
Parse the contents of input
|
void |
setIsRepairing(boolean isRepairing)
Sets a flag to indicate whether this tokenizer should try to repair its token stream
|
void |
setPath(String path) |
void |
setReader(Reader reader) |
boolean |
tokensWereRepaired()
Determines if any tokens were added as a side effect of repair.
|
protected int startOffset
protected MXMLToken xmlNSToken
protected MutablePrefixMap rootPrefixMap
public MXMLTokenizer(String path)
public MXMLTokenizer()
public MXMLTokenizer(IFileSpecification specification)
public MXMLTokenizer(int startOffset)
startOffset
- Start offsetpublic void setPath(String path)
public void setReader(Reader reader)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public PrefixMap getPrefixMap()
PrefixMap
or nullpublic void setIsRepairing(boolean isRepairing)
setIsRepairing
in interface IMXMLTokenizer
isRepairing
- true
to repair, false
to not repairpublic IMXMLToken[] getTokens(Reader reader)
IMXMLTokenizer
IMXMLToken
objects for a given range of text represented by a Reader
getTokens
in interface IMXMLTokenizer
reader
- a Java Reader
IMXMLToken
objectspublic IMXMLToken[] getTokens(String range)
IMXMLTokenizer
IMXMLToken
objects for a given range of text represented by a String
getTokens
in interface IMXMLTokenizer
IMXMLToken
objectspublic boolean hasTokenizationProblems()
public PrefixMap getRootTagPrefixMap()
PrefixMap
for the root tag found within this documentpublic List<ICompilerProblem> getTokenizationProblems()
Collection
of ICompilerProblem
objects, or an empty Collection
public MXMLToken nextToken()
MXMLToken
or null when no more tokens can be producedpublic List<MXMLToken> parseTokens(Reader input)
input
- Reader containing file to be parsedpublic boolean tokensWereRepaired()
protected void buildTokenList(MXMLToken token, List<MXMLToken> list)
token
- The current token.list
- The list of tokens being built.public static void main(String[] args)
Copyright © 2016 The Apache Software Foundation. All rights reserved.