XMLTokener¶
-
public class
XMLTokener
extends JSONTokener¶ The XMLTokener extends the JSONTokener to provide additional methods for the parsing of XML texts.
Author: JSON.org
Fields¶
Constructors¶
Methods¶
nextCDATA¶
-
public String
nextCDATA
()¶ Get the text in the CDATA block.
Throws: - JSONException – If the
]]>
is not found.
Returns: The string up to the
]]>
.- JSONException – If the
nextContent¶
nextEntity¶
-
public Object
nextEntity
(char ampersand)¶ Return the next entity. These entities are translated to Characters:
& ' > < "
.Parameters: - ampersand – An ampersand character.
Throws: - JSONException – If missing ‘;’ in XML entity.
Returns: A Character or an entity String if the entity is not recognized.
nextMeta¶
-
public Object
nextMeta
()¶ Returns the next XML meta token. This is used for skipping over and ...?> structures.
Throws: - JSONException – If a string is not properly closed or if the XML is badly structured.
Returns: Syntax characters (
/ = ! ?
) are returned as Character, and strings and names are returned as Boolean. We don’t care what the values actually are.
nextToken¶
-
public Object
nextToken
()¶ 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.Throws: - JSONException – If the XML is not well formed.
Returns: a String or a Character.