org.json.XMLTokener Class Reference

Inheritance diagram for org.json.XMLTokener:
org.json.JSONTokener

List of all members.

Public Member Functions

 XMLTokener (String s)
String nextCDATA () throws JSONException
Object nextContent () throws JSONException
Object nextEntity (char a) throws JSONException
Object nextMeta () throws JSONException
Object nextToken () throws JSONException
boolean skipPast (String to) throws JSONException

Static Public Attributes

static final java.util.HashMap entity

Static Package Functions

 [static initializer]

Detailed Description

The XMLTokener extends the JSONTokener to provide additional methods for the parsing of XML texts.

Author:
JSON.org
Version:
2010-01-30

Constructor & Destructor Documentation

org.json.XMLTokener.XMLTokener ( String  s  ) 

Construct an XMLTokener from a string.

Parameters:
s A source string.

Member Function Documentation

org.json.XMLTokener.[static initializer] (  )  [static, package]
String org.json.XMLTokener.nextCDATA (  )  throws JSONException

Get the text in the CDATA block.

Returns:
The string up to the ]]>.
Exceptions:
JSONException If the ]]> is not found.
Object org.json.XMLTokener.nextContent (  )  throws JSONException

Get the next XML outer token, trimming whitespace. There are two kinds of tokens: the '<' character which begins a markup tag, and the content text between markup tags.

Returns:
A string, or a '<' Character, or null if there is no more source text.
Exceptions:
JSONException 
Object org.json.XMLTokener.nextEntity ( char  a  )  throws JSONException

Return the next entity. These entities are translated to Characters: & ' > < ".

Parameters:
a An ampersand character.
Returns:
A Character or an entity String if the entity is not recognized.
Exceptions:
JSONException If missing ';' in XML entity.
Object org.json.XMLTokener.nextMeta (  )  throws JSONException

Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures.

Returns:
Syntax characters (< > / = ! ?) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are.
Exceptions:
JSONException If a string is not properly closed or if the XML is badly structured.
Object org.json.XMLTokener.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.

Returns:
a String or a Character.
Exceptions:
JSONException If the XML is not well formed.
boolean org.json.XMLTokener.skipPast ( String  to  )  throws JSONException

Skip characters until past the requested string. If it is not found, we are left at the end of the source with a result of false.

Parameters:
to A string to skip past.
Exceptions:
JSONException 

Member Data Documentation

final java.util.HashMap org.json.XMLTokener.entity [static]

The table of entity values. It initially contains Character values for amp, apos, gt, lt, quot.