Class XMLTokener

java.lang.Object
org.apache.sling.commons.json.JSONTokener
org.apache.sling.commons.json.xml.XMLTokener

@Deprecated public class XMLTokener extends JSONTokener
Deprecated.
The XMLTokener extends the JSONTokener to provide additional methods for the parsing of XML texts.
Version:
2015-12-09
Author:
JSON.org
  • Field Details

    • entity

      public static final HashMap<String,Character> entity
      Deprecated.
      The table of entity values. It initially contains Character values for amp, apos, gt, lt, quot.
  • Constructor Details

    • XMLTokener

      public XMLTokener(Reader r)
      Deprecated.
      Construct an XMLTokener from a Reader.
      Parameters:
      r - A source reader.
    • XMLTokener

      public XMLTokener(String s)
      Deprecated.
      Construct an XMLTokener from a string.
      Parameters:
      s - A source string.
    • XMLTokener

      public XMLTokener(Reader r, org.apache.sling.commons.json.xml.XMLParserConfiguration configuration)
      Deprecated.
      Construct an XMLTokener from a Reader and an XMLParserConfiguration.
      Parameters:
      r - A source reader.
      configuration - the configuration that can be used to set certain flags
  • Method Details

    • nextCDATA

      public String nextCDATA() throws JSONException
      Deprecated.
      Get the text in the CDATA block.
      Returns:
      The string up to the ]]>.
      Throws:
      JSONException - If the ]]> is not found.
    • nextContent

      public Object nextContent() throws JSONException
      Deprecated.
      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.
      Throws:
      JSONException - if a called function has an error
    • nextEntity

      public Object nextEntity(char ampersand) throws JSONException
      Deprecated.
      
       Return the next entity. These entities are translated to Characters:
           &amp;  &apos;  &gt;  &lt;  &quot;.
       
      Parameters:
      ampersand - An ampersand character.
      Returns:
      A Character or an entity String if the entity is not recognized.
      Throws:
      JSONException - If missing ';' in XML entity.
    • nextMeta

      public Object nextMeta() throws JSONException
      Deprecated.
      
       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.
        
      Throws:
      JSONException - If a string is not properly closed or if the XML is badly structured.
    • nextToken

      public Object nextToken() throws JSONException
      Deprecated.
      
       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.
      Throws:
      JSONException - If the XML is not well formed.