rabbit.html
Class HTMLParser

java.lang.Object
  extended byrabbit.html.HTMLParser

public class HTMLParser
extends java.lang.Object

This is a class that is used to parse a block of HTML code into separate tokens. This parser uses a recursive descent approach.


Field Summary
static int COMMENT
          A HTML comment "<!-- some text -->"
static int DOUBLEQUOTE
          This is the character '"'
static int DQSTRING
          This is a Double Quoted String a "string"
static int END
          This indicates the end of a block.
static int EQUALS
          Equals '='
static int LT
          Less Than '<'
static int MT
          More Than '>'
static int SINGELQUOTE
          This is the character '''
static int SQSTRING
          This is a Single Quoted String a 'string'
static int START
          This indicates the start of a block.
static int STRING
          This indicate a String value was found.
static int UNKNOWN
          Unknown token.
 
Constructor Summary
HTMLParser()
          Create a new HTMLParser
HTMLParser(byte[] page)
          Create a new HTMLParser for the given page.
 
Method Summary
static void main(java.lang.String[] args)
          Simple self test function.
 HTMLBlock parse()
          Get a HTMLBlock from the pagepart given.
 void setText(byte[] page)
          Set the data block to parse.
 void setText(byte[] page, int length)
          Set the data block to parse.
 void setText(java.lang.String page)
          Set the data to parse.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START

public static final int START
This indicates the start of a block.

See Also:
Constant Field Values

STRING

public static final int STRING
This indicate a String value was found.

See Also:
Constant Field Values

SQSTRING

public static final int SQSTRING
This is a Single Quoted String a 'string'

See Also:
Constant Field Values

DQSTRING

public static final int DQSTRING
This is a Double Quoted String a "string"

See Also:
Constant Field Values

SINGELQUOTE

public static final int SINGELQUOTE
This is the character '''

See Also:
Constant Field Values

DOUBLEQUOTE

public static final int DOUBLEQUOTE
This is the character '"'

See Also:
Constant Field Values

LT

public static final int LT
Less Than '<'

See Also:
Constant Field Values

MT

public static final int MT
More Than '>'

See Also:
Constant Field Values

EQUALS

public static final int EQUALS
Equals '='

See Also:
Constant Field Values

COMMENT

public static final int COMMENT
A HTML comment "<!-- some text -->"

See Also:
Constant Field Values

END

public static final int END
This indicates the end of a block.

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
Unknown token.

See Also:
Constant Field Values
Constructor Detail

HTMLParser

public HTMLParser()
Create a new HTMLParser


HTMLParser

public HTMLParser(byte[] page)
Create a new HTMLParser for the given page.

Parameters:
page - the block to parse.
Method Detail

setText

public void setText(byte[] page)
Set the data block to parse.

Parameters:
page - the block to parse.

setText

public void setText(byte[] page,
                    int length)
Set the data block to parse.

Parameters:
page - the block to parse.
length - the length of the data.

setText

public void setText(java.lang.String page)
Set the data to parse.

Parameters:
page - the block to parse.

parse

public HTMLBlock parse()
                throws HTMLParseException
Get a HTMLBlock from the pagepart given.

Throws:
HTMLParseException

main

public static void main(java.lang.String[] args)
Simple self test function.