public class XMLTokener extends JSONTokener
Modifier and Type | Field and Description |
---|---|
static java.util.HashMap<java.lang.String,java.lang.Character> |
ENTITY
The table of ENTITY values.
|
Constructor and Description |
---|
XMLTokener(java.lang.String s)
Construct an XMLTokener from a string.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
nextCDATA()
Get the text in the CDATA block.
|
java.lang.Object |
nextContent()
Get the next XML outer token, trimming whitespace.
|
java.lang.Object |
nextEntity(char a)
Return the next ENTITY.
|
java.lang.Object |
nextMeta()
Returns the next XML meta token.
|
java.lang.Object |
nextToken()
Get the next XML Token.
|
boolean |
skipPast(java.lang.String to)
Skip characters until past the requested string.
|
back, dehexchar, more, next, next, next, nextClean, nextString, nextTo, nextTo, nextValue, setOrdered, skipTo, syntaxError, toString
public static final java.util.HashMap<java.lang.String,java.lang.Character> ENTITY
public XMLTokener(java.lang.String s)
s
- a source stringpublic java.lang.String nextCDATA() throws JSONException
]]>
JSONException
- if the ]]>
is not foundpublic java.lang.Object nextContent() throws JSONException
There are two kinds of tokens: the '<' character which begins a markup tag, and the content text between markup tags.
JSONException
- if something goes wrongpublic java.lang.Object nextEntity(char a) throws JSONException
& ' > < "
.a
- an ampersand characterJSONException
- if missing ';' in XML entitypublic java.lang.Object nextMeta() throws JSONException
< > / = ! ?
) are returned as
Character, and strings and names are returned as Boolean. We don't care
what the values actually areJSONException
- if a string is not properly closed or if the XML
is badly structuredpublic java.lang.Object nextToken() throws JSONException
These tokens are found inside of angle
brackets. It may be one of these characters: / > = ! ?
or it
may be a string wrapped in single quotes or double quotes, or it may be a
name.
JSONException
- if the XML is not well formedpublic boolean skipPast(java.lang.String to) throws JSONException
If it is not found, we are left at the end of the source with a result of false.
to
- a string to skip pastJSONException
- if something goes wrong