Node Director
Public Member Functions | Static Public Attributes | List of all members
org.json.XMLTokener Class Reference

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

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

Public Member Functions

 XMLTokener (String s)
 Construct an XMLTokener from a string.
Object nextContent () throws ParseException
 Get the next XML outer token, trimming whitespace.
Object nextEntity (char a) throws ParseException
 Return the next entity.
Object nextMeta () throws ParseException
 Returns the next XML meta token.
Object nextToken () throws ParseException
 Get the next XML Token.
- Public Member Functions inherited from org.json.JSONTokener
 JSONTokener (String s)
 Construct a JSONTokener from a string.
void back ()
 Back up one character.
boolean more ()
 Determine if the source string still contains characters that next() can consume.
char next ()
 Get the next character in the source string.
char next (char c) throws ParseException
 Consume the next character, and check that it matches a specified character.
String next (int n) throws ParseException
 Get the next n characters.
char nextClean () throws java.text.ParseException
 Get the next char in the string, skipping whitespace and comments (slashslash, slashstar, and hash).
String nextString (char quote) throws ParseException
 Return the characters up to the next close quote character.
String nextTo (char d)
 Get the text up but not including the specified character or the end of line, whichever comes first.
String nextTo (String delimiters)
 Get the text up but not including one of the specified delimeter characters or the end of line, whichever comes first.
Date nextDate () throws ParseException
Object nextValue () throws ParseException
 Get the next value.
char skipTo (char to)
 Skip characters until the next character is the requested character.
void skipPast (String to)
 Skip characters until past the requested string.
ParseException syntaxError (String message)
 Make a ParseException to signal a syntax error.
String toString ()
 Make a printable string of this JSONTokener.

Static Public Attributes

static final java.util.HashMap entity
 The table of entity values.

Additional Inherited Members

- Static Public Member Functions inherited from org.json.JSONTokener
static int dehexchar (char c)
 Get the hex value of a character (base16).
static String unescape (String s)
 Convert %hh sequences to single characters, and convert plus to space.

Detailed Description

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

Author
JSON.org
Version
0.1

Constructor & Destructor Documentation

org.json.XMLTokener.XMLTokener ( String  s)

Construct an XMLTokener from a string.

Parameters
sA source string.

Member Function Documentation

Object org.json.XMLTokener.nextContent ( ) throws ParseException

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
ParseException

References org.json.JSONTokener.back(), org.json.XML.LT, org.json.JSONTokener.next(), and org.json.XMLTokener.nextEntity().

Object org.json.XMLTokener.nextEntity ( char  a) throws ParseException

Return the next entity.

These entities are translated to Characters: & ' > < "

Parameters
aAn ampersand character.
Returns
A Character or an entity String if the entity is not recognized.
Exceptions
ParseExceptionMissing ';' in XML entity

References org.json.XMLTokener.entity, org.json.JSONTokener.next(), and org.json.JSONTokener.syntaxError().

Referenced by org.json.XMLTokener.nextContent(), and org.json.XMLTokener.nextToken().

Object org.json.XMLTokener.nextMeta ( ) throws ParseException

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
ParseException

References org.json.JSONTokener.back(), org.json.XML.BANG, org.json.XML.EQ, org.json.XML.GT, org.json.XML.LT, org.json.JSONTokener.next(), org.json.XML.QUEST, org.json.XML.SLASH, and org.json.JSONTokener.syntaxError().

Object org.json.XMLTokener.nextToken ( ) throws ParseException

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
ParseException

References org.json.JSONTokener.back(), org.json.XML.BANG, org.json.XML.EQ, org.json.XML.GT, org.json.JSONTokener.next(), org.json.XMLTokener.nextEntity(), org.json.XML.QUEST, org.json.XML.SLASH, and org.json.JSONTokener.syntaxError().

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.

Referenced by org.json.XMLTokener.nextEntity().


The documentation for this class was generated from the following file: