public class XMLTokener extends JSONTokener
Modifier and Type | Field and Description |
---|---|
static HashMap<String,Character> |
entity
The table of entity values.
|
Constructor and Description |
---|
XMLTokener(Reader r)
Construct an XMLTokener from a Reader.
|
XMLTokener(String s)
Construct an XMLTokener from a string.
|
Modifier and Type | Method and Description |
---|---|
String |
nextCDATA()
Get the text in the CDATA block.
|
Object |
nextContent()
Get the next XML outer token, trimming whitespace.
|
Object |
nextEntity(char ampersand)
{@code
Return the next entity.
|
Object |
nextMeta()
{@code
Returns the next XML meta token.
|
Object |
nextToken()
{@code
Get the next XML Token.
|
void |
skipPast(String to)
Skip characters until past the requested string.
|
back, dehexchar, end, more, next, next, next, nextClean, nextString, nextTo, nextTo, nextValue, skipTo, syntaxError, syntaxError, toString
public XMLTokener(Reader r)
r
- A source reader.public XMLTokener(String s)
s
- A source string.public String nextCDATA() throws JSONException
]]>
.JSONException
- If the ]]>
is not found.public Object nextContent() throws JSONException
'<'
character which begins a markup
tag, and the content
text between markup tags. '<'
Character, or null if
there is no more source text.JSONException
- if a called function has an errorpublic Object nextEntity(char ampersand) throws JSONException
Return the next entity. These entities are translated to Characters:
& ' > < ".
ampersand
- An ampersand character.JSONException
- If missing ';' in XML entity.public Object nextMeta() throws JSONException
Returns the next XML meta token. This is used for skipping over <!...>
and <?...?> structures.
Syntax characters (< > / = ! ?) are returned as
Character, and strings and names are returned as Boolean. We don't care
what the values actually are.
JSONException
- If a string is not properly closed or if the XML
is badly structured.public Object nextToken() throws JSONException
Get the next XML Token. 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 formed.public void skipPast(String to)
to
- A string to skip past.