fi.iki.hsivonen.xml.checker.table
Class TableChecker

java.lang.Object
  extended by fi.iki.hsivonen.xml.checker.Checker
      extended by fi.iki.hsivonen.xml.checker.table.TableChecker
All Implemented Interfaces:
ContentHandler

public final class TableChecker
extends Checker

Checks XHTML table integrity: overlapping cells, spanning past the end of row group, etc.

Version:
$Id: TableChecker.java,v 1.5 2006/12/01 12:34:30 hsivonen Exp $
Author:
hsivonen

Field Summary
private  Table current
          Holds the current table.
private  LinkedList<Table> stack
          A stack for holding the tables that are open and ancestors of the current table.
 
Constructor Summary
TableChecker()
          Constructor.
 
Method Summary
 void endElement(String uri, String localName, String qName)
           
private  void pop()
          Ends the current table, discards it and pops the top of the stack to be the new current table.
private  void push()
          Pushes the current table onto the stack and creates a new one.
 void reset()
          Does nothing.
 void startElement(String uri, String localName, String qName, Attributes atts)
           
 
Methods inherited from class fi.iki.hsivonen.xml.checker.Checker
characters, endDocument, endPrefixMapping, err, getDocumentLocator, getErrorHandler, ignorableWhitespace, processingInstruction, setDocumentLocator, setErrorHandler, skippedEntity, startDocument, startPrefixMapping, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current

private Table current
Holds the current table. (Premature optimization to avoid peeking the top of the stack all the time.)


stack

private final LinkedList<Table> stack
A stack for holding the tables that are open and ancestors of the current table. Grows from the tail.

Constructor Detail

TableChecker

public TableChecker()
Constructor.

Method Detail

push

private void push()
Pushes the current table onto the stack and creates a new one.


pop

private void pop()
          throws SAXException
Ends the current table, discards it and pops the top of the stack to be the new current table.

Throws:
SAXException - if ending the table throws

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class Checker
Throws:
SAXException
See Also:
Checker.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class Checker
Throws:
SAXException
See Also:
Checker.endElement(java.lang.String, java.lang.String, java.lang.String)

reset

public void reset()
Description copied from class: Checker
Does nothing. Subclasses are expected to override this method with an implementation that clears the state of the checker and releases objects the checker might hold references to.

Overrides:
reset in class Checker
See Also:
Checker.reset()