nu.validator.htmlparser.test
Class JSONArrayTokenHandler

java.lang.Object
  extended by nu.validator.htmlparser.test.JSONArrayTokenHandler
All Implemented Interfaces:
TokenHandler, ErrorHandler

public class JSONArrayTokenHandler
extends Object
implements TokenHandler, ErrorHandler


Field Summary
private  com.sdicons.json.model.JSONArray array
           
private  StringBuilder builder
           
private static com.sdicons.json.model.JSONString CHARACTER
           
private static com.sdicons.json.model.JSONString COMMENT
           
private  String contentModelElement
           
private  ContentModelFlag contentModelFlag
           
private static com.sdicons.json.model.JSONString DOCTYPE
           
private static com.sdicons.json.model.JSONString END_TAG
           
private static com.sdicons.json.model.JSONString PARSE_ERROR
           
private static com.sdicons.json.model.JSONString START_TAG
           
 
Constructor Summary
JSONArrayTokenHandler()
           
 
Method Summary
 void characters(char[] buf, int start, int length)
          Receive character tokens.
 void comment(char[] buf, int length)
          Receive a comment token.
 void doctype(String name, String publicIdentifier, String systemIdentifier, boolean correct)
          Receive a doctype token.
 void endTag(String name, Attributes attributes)
          Receive an end tag token.
 void eof()
          The end-of-file token.
 void error(SAXParseException exception)
           
 void fatalError(SAXParseException exception)
           
private  void flushCharacters()
           
 com.sdicons.json.model.JSONArray getArray()
          Returns the array.
 void setContentModelFlag(ContentModelFlag contentModelFlag, String contentModelElement)
           
 void start(Tokenizer self)
          This method is called at the start of tokenization before any other methods on this interface are called.
 void startTag(String name, Attributes attributes)
          Receive a start tag token.
 boolean wantsComments()
          If this handler implementation cares about comments, return true.
 void warning(SAXParseException exception)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCTYPE

private static final com.sdicons.json.model.JSONString DOCTYPE

START_TAG

private static final com.sdicons.json.model.JSONString START_TAG

END_TAG

private static final com.sdicons.json.model.JSONString END_TAG

COMMENT

private static final com.sdicons.json.model.JSONString COMMENT

CHARACTER

private static final com.sdicons.json.model.JSONString CHARACTER

PARSE_ERROR

private static final com.sdicons.json.model.JSONString PARSE_ERROR

builder

private final StringBuilder builder

array

private com.sdicons.json.model.JSONArray array

contentModelFlag

private ContentModelFlag contentModelFlag

contentModelElement

private String contentModelElement
Constructor Detail

JSONArrayTokenHandler

public JSONArrayTokenHandler()
Method Detail

setContentModelFlag

public void setContentModelFlag(ContentModelFlag contentModelFlag,
                                String contentModelElement)

characters

public void characters(char[] buf,
                       int start,
                       int length)
                throws SAXException
Description copied from interface: TokenHandler
Receive character tokens. This method has the same semantics as the SAX method of the same name.

Specified by:
characters in interface TokenHandler
Parameters:
buf - a buffer holding the data
start - offset into the buffer
length - the number of code units to read
Throws:
SAXException - if something went wrong
See Also:
ContentHandler.characters(char[], int, int)

flushCharacters

private void flushCharacters()

comment

public void comment(char[] buf,
                    int length)
             throws SAXException
Description copied from interface: TokenHandler
Receive a comment token. The data is junk if the wantsComments() returned false.

Specified by:
comment in interface TokenHandler
Parameters:
buf - a buffer holding the data
length - the number of code units to read
Throws:
SAXException - if something went wrong

doctype

public void doctype(String name,
                    String publicIdentifier,
                    String systemIdentifier,
                    boolean correct)
             throws SAXException
Description copied from interface: TokenHandler
Receive a doctype token.

Specified by:
doctype in interface TokenHandler
Parameters:
name - the name
publicIdentifier - the public id
systemIdentifier - the system id
correct - whether the token is correct
Throws:
SAXException - if something went wrong

endTag

public void endTag(String name,
                   Attributes attributes)
            throws SAXException
Description copied from interface: TokenHandler
Receive an end tag token.

Specified by:
endTag in interface TokenHandler
Parameters:
name - the tag name
attributes - the attributes
Throws:
SAXException - if something went wrong

eof

public void eof()
         throws SAXException
Description copied from interface: TokenHandler
The end-of-file token.

Specified by:
eof in interface TokenHandler
Throws:
SAXException - if something went wrong

start

public void start(Tokenizer self)
           throws SAXException
Description copied from interface: TokenHandler
This method is called at the start of tokenization before any other methods on this interface are called. Implementations should hold the reference to the Tokenizer in order to set the content model flag and in order to be able to query for Locator data.

Specified by:
start in interface TokenHandler
Parameters:
self - the Tokenizer.
Throws:
SAXException - if something went wrong

startTag

public void startTag(String name,
                     Attributes attributes)
              throws SAXException
Description copied from interface: TokenHandler
Receive a start tag token.

Specified by:
startTag in interface TokenHandler
Parameters:
name - the tag name
attributes - the attributes
Throws:
SAXException - if something went wrong

wantsComments

public boolean wantsComments()
                      throws SAXException
Description copied from interface: TokenHandler
If this handler implementation cares about comments, return true. If not, return false.

Specified by:
wantsComments in interface TokenHandler
Returns:
whether this handler wants comments
Throws:
SAXException - if something went wrong

error

public void error(SAXParseException exception)
           throws SAXException
Specified by:
error in interface ErrorHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException exception)
                throws SAXException
Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException

warning

public void warning(SAXParseException exception)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Throws:
SAXException

getArray

public com.sdicons.json.model.JSONArray getArray()
Returns the array.

Returns:
the array