Groovy Documentation

org.jdesktop.dom
[Java] Class HTMLBuilder

java.lang.Object
  org.xml.sax.helpers.DefaultHandler
      org.xml.sax.ext.DefaultHandler2
          org.jdesktop.dom.HTMLBuilder

class HTMLBuilder
extends DefaultHandler2

This is a SAX document handler that is used to build an HTML document. It can build a document from any SAX parser. NOTE: I'm not sure how copyright works in this case. The original code was BSD. It was copied here and somewhat altered. Hopefully in the future we can just use Xerces, and it will implement the HTML parsing for us.

Authors:
Assaf Arkin
Version:
\$Revision\$ \$Date\$


Field Summary
protected org.apache.xerces.dom.ElementImpl _current

The current node in the document into which elements, text and other nodes will be inserted.

protected org.apache.html.dom.HTMLDocumentImpl _document

The document that is being built.

private boolean _done

Indicates whether finished building a document.

private boolean _ignoreWhitespace

Applies only to whitespace appearing between element tags in element content, as per the SAX definition, and true by default.

private Locator _locator

A reference to the current locator, this is generally the parser itself.

protected Vector _preRootNodes

The document is only created the same time as the document element, however, certain nodes may precede the document element (comment and PI), and they are accumulated in this vector.

 
Constructor Summary
HTMLBuilder()

 
Method Summary
void characters(char[] text, int start, int length)

void endDocument()

void endElement(String uri, String localName, String qName)

org.w3c.dom.html.HTMLDocument getHTMLDocument()

private String getName(String qName, String localName)

void ignorableWhitespace(char[] text, int start, int length)

void processingInstruction(String target, String instruction)

void setDocumentLocator(Locator locator)

void startDocument()

void startElement(String uri, String localName, String qName, Attributes attrList)

 
Methods inherited from class DefaultHandler2
comment, resolveEntity, resolveEntity, startCDATA, endCDATA, startDTD, endDTD, internalEntityDecl, externalEntityDecl, elementDecl, attributeDecl, startEntity, endEntity, getExternalSubset, fatalError, error, warning, processingInstruction, startDocument, startElement, characters, ignorableWhitespace, endElement, endDocument, unparsedEntityDecl, notationDecl, setDocumentLocator, startPrefixMapping, endPrefixMapping, skippedEntity, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 
Methods inherited from class DefaultHandler
fatalError, error, warning, resolveEntity, processingInstruction, startDocument, startElement, characters, ignorableWhitespace, endElement, endDocument, unparsedEntityDecl, notationDecl, setDocumentLocator, startPrefixMapping, endPrefixMapping, skippedEntity, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

_current

protected org.apache.xerces.dom.ElementImpl _current
The current node in the document into which elements, text and other nodes will be inserted. This starts as the document iself and reflects each element that is currently being parsed.


_document

protected org.apache.html.dom.HTMLDocumentImpl _document
The document that is being built.


_done

private boolean _done
Indicates whether finished building a document. If so, can start building another document. Must be initially true to get the first document processed.


_ignoreWhitespace

private boolean _ignoreWhitespace
Applies only to whitespace appearing between element tags in element content, as per the SAX definition, and true by default.


_locator

private Locator _locator
A reference to the current locator, this is generally the parser itself. The locator is used to locate errors and identify the source locations of elements.


_preRootNodes

protected Vector _preRootNodes
The document is only created the same time as the document element, however, certain nodes may precede the document element (comment and PI), and they are accumulated in this vector.


 
Constructor Detail

HTMLBuilder

HTMLBuilder()


 
Method Detail

characters

public void characters(char[] text, int start, int length)


endDocument

public void endDocument()


endElement

public void endElement(String uri, String localName, String qName)


getHTMLDocument

public org.w3c.dom.html.HTMLDocument getHTMLDocument()


getName

private String getName(String qName, String localName)


ignorableWhitespace

public void ignorableWhitespace(char[] text, int start, int length)


processingInstruction

public void processingInstruction(String target, String instruction)


setDocumentLocator

public void setDocumentLocator(Locator locator)


startDocument

public void startDocument()


startElement

public void startElement(String uri, String localName, String qName, Attributes attrList)


 

Groovy Documentation