prupp.html
Class HTMLBlock

java.lang.Object
  |
  +--prupp.html.HTMLBlock

public class HTMLBlock
extends java.lang.Object

A class to handle a block of text and split it into a text/tags - vector.


Constructor Summary
HTMLBlock(java.lang.String pagepart)
          create a new HTMLBlock with the given page.
 
Method Summary
protected  int findSeparator(int i)
          Get the index of the next separator character.
protected  int findwhite(int i)
          find the index of a "white" that is something that ends a token
protected  int getCommentTag(int i)
          Get the index of where the comment ends.
 java.util.Vector getElements()
          Get the Vector of elements (the strings and tags).
 java.lang.String getRest()
          Get the rest of the block.
static void main(java.lang.String[] args)
          Simple testprogram for this class.
protected  int nextNonWhite(int i)
          Get the index of the next nonwhite token.
protected  void parse()
          build the internal representation
protected  int setAttributes(HTMLTag html, int start)
          Sets all attributes for a htmltag.
 java.lang.String toString()
          Get the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTMLBlock

public HTMLBlock(java.lang.String pagepart)
create a new HTMLBlock with the given page.
Parameters:
pagepart - the block of data to handle.
Method Detail

parse

protected void parse()
build the internal representation

findwhite

protected int findwhite(int i)
find the index of a "white" that is something that ends a token
Parameters:
i - the index to search from.
Returns:
the index to the white-char.

nextNonWhite

protected int nextNonWhite(int i)
Get the index of the next nonwhite token.
Parameters:
i - the index to search from
Returns:
the index of the next non-white token

findSeparator

protected int findSeparator(int i)
Get the index of the next separator character.
Parameters:
i - the index to search from
Returns:
the index of the next separator character.

setAttributes

protected int setAttributes(HTMLTag html,
                            int start)
Sets all attributes for a htmltag.
Parameters:
start - the index to start getting tokens from.
Returns:
the end index of the tag.

getCommentTag

protected int getCommentTag(int i)
Get the index of where the comment ends.
Parameters:
i - the index to start searching from.
Returns:
the index of "-->".

toString

public java.lang.String toString()
Get the string representation of this object.
Returns:
a string describing this object.
Overrides:
toString in class java.lang.Object

getElements

public java.util.Vector getElements()
Get the Vector of elements (the strings and tags).
Returns:
a Vector of String and HTMLTag objects.

getRest

public java.lang.String getRest()
Get the rest of the block. That is the part which couldnt be parsed (non-ended tags).
Returns:
a string with the part that couldnt be parsed.

main

public static void main(java.lang.String[] args)
Simple testprogram for this class.