Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.arthurdo.parser
Class Table  view Table download Table.java

java.lang.Object
  extended bycom.arthurdo.parser.Table

public class Table
extends java.lang.Object

Null Cells and Phantom Rows

elementAt() can return null if there is no cell at the requested coordinate due to spans across areas where there are no cells, for example,

<table>
<tr><td rowspan=2>abc<td>def
</table>

In this case, calling elementAt(1, 1) would return null. Similarly, getRowTag() could return null if the requested index is a phantom row (a row that doesn't have any real cells). In the example above, the table has two rows due to the rowspan but row 1 is a phantom row and does not have a <tr> tag.

Implementation Note: the table parser is very strict, that is, <TABLE> can only contain <TR>. <TR> can only contain <TD>. Any deviation from this nesting is considered bad data and will be thrown away by the parser. In a future release, we hope to be more forgiving.

Version:
0.9 01/32/98

Field Summary
private  TableCell m_cell
           
private  TableCell[][] m_elements
           
private  boolean m_pushback
           
private  java.util.Vector m_row
           
private  java.util.Vector m_rows
           
private  java.util.Vector m_rowTags
           
private  java.lang.StringBuffer m_stringValue
           
private  HtmlTag m_tableTag
           
private  HtmlStreamTokenizer m_tok
           
private  int m_tokenType
           
private  java.lang.StringBuffer m_whiteSpace
           
 
Constructor Summary
Table()
           
 
Method Summary
private  void addToCell(java.lang.Object o)
           
private  void beginCell(HtmlTag tag)
           
 TableCell elementAt(int row, int col)
           
private  void endCell()
           
 int getColumns()
           
 int getRows()
           
 HtmlTag getRowTag(int row)
           
private  java.lang.StringBuffer getStringValue()
           
 HtmlTag getTableTag()
           
private  int getTokenType()
           
private  java.lang.StringBuffer getWhiteSpace()
           
private  void newRow()
           
private  int nextToken()
           
private  void organizeRowCol()
           
private  boolean parseCol()
           
private  boolean parseRow()
           
 void parseTable(HtmlStreamTokenizer tokenizer, HtmlTag tableTag)
           
 void parseTable(java.io.InputStream in)
          Deprecated. use parseTable(Reader) instead. This version of the constructor can lead to 10x slower code because of the InputStreamReader wrapper.
 void parseTable(java.io.Reader in)
           
private  void pushBackToken()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_tok

private HtmlStreamTokenizer m_tok

m_pushback

private boolean m_pushback

m_tokenType

private int m_tokenType

m_stringValue

private java.lang.StringBuffer m_stringValue

m_whiteSpace

private java.lang.StringBuffer m_whiteSpace

m_cell

private TableCell m_cell

m_row

private java.util.Vector m_row

m_rows

private java.util.Vector m_rows

m_elements

private TableCell[][] m_elements

m_tableTag

private HtmlTag m_tableTag

m_rowTags

private java.util.Vector m_rowTags
Constructor Detail

Table

public Table()
Method Detail

parseTable

public void parseTable(java.io.InputStream in)
                throws HtmlException,
                       java.io.IOException
Deprecated. use parseTable(Reader) instead. This version of the constructor can lead to 10x slower code because of the InputStreamReader wrapper.


parseTable

public void parseTable(java.io.Reader in)
                throws HtmlException,
                       java.io.IOException

parseTable

public void parseTable(HtmlStreamTokenizer tokenizer,
                       HtmlTag tableTag)
                throws HtmlException,
                       java.io.IOException

getTableTag

public HtmlTag getTableTag()

getRowTag

public HtmlTag getRowTag(int row)

getRows

public int getRows()

getColumns

public int getColumns()

elementAt

public TableCell elementAt(int row,
                           int col)

organizeRowCol

private void organizeRowCol()
                     throws HtmlException

parseRow

private boolean parseRow()
                  throws java.io.IOException

parseCol

private boolean parseCol()
                  throws java.io.IOException

newRow

private void newRow()

beginCell

private void beginCell(HtmlTag tag)

endCell

private void endCell()

addToCell

private void addToCell(java.lang.Object o)

nextToken

private int nextToken()
               throws java.io.IOException

pushBackToken

private void pushBackToken()
                    throws java.io.IOException

getTokenType

private int getTokenType()

getStringValue

private java.lang.StringBuffer getStringValue()

getWhiteSpace

private java.lang.StringBuffer getWhiteSpace()