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(CharSequence s,
JSONConfig config)
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)
Return the next entity.
|
Object |
nextMeta()
Returns the next XML meta token.
|
Object |
nextToken()
Get the next XML Token.
|
boolean |
skipPast(String to)
Skip characters until past the requested string.
|
back, end, getPrevious, more, next, next, next, nextClean, nextString, nextStringValue, nextTo, nextTo, nextValue, skipTo, syntaxError, toJSONArray, toStringpublic XMLTokener(CharSequence s, JSONConfig config)
s - A source string.config - JSON配置public String nextCDATA() throws JSONException
]]>.JSONException - If the ]]> is not found.public Object nextContent() throws JSONException
JSONException - JSONpublic Object nextEntity(char ampersand) throws JSONException
& ' > < ".ampersand - An ampersand character.JSONException - If missing ';' in XML entity.public Object nextMeta() throws JSONException
< > / = ! ?) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are.JSONException - 字符串中属性未关闭或XML结构错误抛出此异常。If a string is not properly closed or if the XML is badly structured.public Object nextToken() throws JSONException
/ > = ! ? 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 boolean skipPast(String to) throws JSONException
to - A string to skip past.JSONException - JSON异常Copyright © 2025. All rights reserved.