org.cyberneko.html.parsers
Class DOMFragmentParser

java.lang.Object
  |
  +--org.cyberneko.html.parsers.DOMFragmentParser
All Implemented Interfaces:
org.apache.xerces.xni.XMLDocumentHandler

public class DOMFragmentParser
extends java.lang.Object
implements org.apache.xerces.xni.XMLDocumentHandler

A DOM parser for HTML fragments.

Version:
$Id$
Author:
Andy Clark

Field Summary
protected static java.lang.String DOCUMENT_FRAGMENT
          Document fragment balancing only.
protected  org.w3c.dom.Node fCurrentNode
          Current node.
protected  org.w3c.dom.DocumentFragment fDocumentFragment
          DOM document fragment.
protected  org.apache.xerces.xni.parser.XMLDocumentSource fDocumentSource
          Document source.
protected  org.w3c.dom.html.HTMLDocument fHTMLDocument
          HTML document.
protected  boolean fInCDATASection
          True if within a CDATA section.
protected  org.apache.xerces.xni.parser.XMLParserConfiguration fParserConfiguration
          Parser configuration.
 
Constructor Summary
DOMFragmentParser()
          Default constructor.
 
Method Summary
 void characters(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)
          Characters.
 void comment(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)
          Comment.
 void doctypeDecl(java.lang.String root, java.lang.String pubid, java.lang.String sysid, org.apache.xerces.xni.Augmentations augs)
          Document type declaration.
 void emptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs, org.apache.xerces.xni.Augmentations augs)
          Empty element.
 void endCDATA(org.apache.xerces.xni.Augmentations augs)
          End CDATA section.
 void endDocument(org.apache.xerces.xni.Augmentations augs)
          End document.
 void endElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)
          End element.
 void endGeneralEntity(java.lang.String name, org.apache.xerces.xni.Augmentations augs)
          End general entity.
 void endPrefixMapping(java.lang.String prefix, org.apache.xerces.xni.Augmentations augs)
          End prefix mapping.
 org.apache.xerces.xni.parser.XMLDocumentSource getDocumentSource()
          Returns the document source.
 void ignorableWhitespace(org.apache.xerces.xni.XMLString text, org.apache.xerces.xni.Augmentations augs)
          Ignorable whitespace.
 void parse(org.xml.sax.InputSource source, org.w3c.dom.DocumentFragment fragment)
          Parses a document fragment.
 void parse(java.lang.String systemId, org.w3c.dom.DocumentFragment fragment)
          Parses a document fragment.
 void processingInstruction(java.lang.String target, org.apache.xerces.xni.XMLString data, org.apache.xerces.xni.Augmentations augs)
          Processing instruction.
 void setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
          Sets the document source.
 void startCDATA(org.apache.xerces.xni.Augmentations augs)
          Start CDATA section.
 void startDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs)
          Start document.
 void startDocument(org.apache.xerces.xni.XMLLocator locator, java.lang.String encoding, org.apache.xerces.xni.NamespaceContext nscontext, org.apache.xerces.xni.Augmentations augs)
          Start document.
 void startElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attrs, org.apache.xerces.xni.Augmentations augs)
          Start element.
 void startGeneralEntity(java.lang.String name, org.apache.xerces.xni.XMLResourceIdentifier id, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs)
          Start general entity.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri, org.apache.xerces.xni.Augmentations augs)
          Start prefix mapping.
 void textDecl(java.lang.String version, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs)
          Text declaration.
 void xmlDecl(java.lang.String version, java.lang.String encoding, java.lang.String standalone, org.apache.xerces.xni.Augmentations augs)
          XML declaration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_FRAGMENT

protected static final java.lang.String DOCUMENT_FRAGMENT
Document fragment balancing only.

See Also:
Constant Field Values

fParserConfiguration

protected org.apache.xerces.xni.parser.XMLParserConfiguration fParserConfiguration
Parser configuration.


fDocumentSource

protected org.apache.xerces.xni.parser.XMLDocumentSource fDocumentSource
Document source.


fDocumentFragment

protected org.w3c.dom.DocumentFragment fDocumentFragment
DOM document fragment.


fHTMLDocument

protected org.w3c.dom.html.HTMLDocument fHTMLDocument
HTML document.


fCurrentNode

protected org.w3c.dom.Node fCurrentNode
Current node.


fInCDATASection

protected boolean fInCDATASection
True if within a CDATA section.

Constructor Detail

DOMFragmentParser

public DOMFragmentParser()
Default constructor.

Method Detail

parse

public void parse(java.lang.String systemId,
                  org.w3c.dom.DocumentFragment fragment)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parses a document fragment.

org.xml.sax.SAXException
java.io.IOException

parse

public void parse(org.xml.sax.InputSource source,
                  org.w3c.dom.DocumentFragment fragment)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parses a document fragment.

org.xml.sax.SAXException
java.io.IOException

setDocumentSource

public void setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
Sets the document source.

Specified by:
setDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandler

getDocumentSource

public org.apache.xerces.xni.parser.XMLDocumentSource getDocumentSource()
Returns the document source.

Specified by:
getDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandler

startDocument

public void startDocument(org.apache.xerces.xni.XMLLocator locator,
                          java.lang.String encoding,
                          org.apache.xerces.xni.Augmentations augs)
                   throws org.apache.xerces.xni.XNIException
Start document.

org.apache.xerces.xni.XNIException

startDocument

public void startDocument(org.apache.xerces.xni.XMLLocator locator,
                          java.lang.String encoding,
                          org.apache.xerces.xni.NamespaceContext nscontext,
                          org.apache.xerces.xni.Augmentations augs)
                   throws org.apache.xerces.xni.XNIException
Start document.

Specified by:
startDocument in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

xmlDecl

public void xmlDecl(java.lang.String version,
                    java.lang.String encoding,
                    java.lang.String standalone,
                    org.apache.xerces.xni.Augmentations augs)
             throws org.apache.xerces.xni.XNIException
XML declaration.

Specified by:
xmlDecl in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

doctypeDecl

public void doctypeDecl(java.lang.String root,
                        java.lang.String pubid,
                        java.lang.String sysid,
                        org.apache.xerces.xni.Augmentations augs)
                 throws org.apache.xerces.xni.XNIException
Document type declaration.

Specified by:
doctypeDecl in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  org.apache.xerces.xni.XMLString data,
                                  org.apache.xerces.xni.Augmentations augs)
                           throws org.apache.xerces.xni.XNIException
Processing instruction.

Specified by:
processingInstruction in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

comment

public void comment(org.apache.xerces.xni.XMLString text,
                    org.apache.xerces.xni.Augmentations augs)
             throws org.apache.xerces.xni.XNIException
Comment.

Specified by:
comment in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri,
                               org.apache.xerces.xni.Augmentations augs)
                        throws org.apache.xerces.xni.XNIException
Start prefix mapping. @deprecated Since Xerces 2.2.0.

org.apache.xerces.xni.XNIException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix,
                             org.apache.xerces.xni.Augmentations augs)
                      throws org.apache.xerces.xni.XNIException
End prefix mapping. @deprecated Since Xerces 2.2.0.

org.apache.xerces.xni.XNIException

startElement

public void startElement(org.apache.xerces.xni.QName element,
                         org.apache.xerces.xni.XMLAttributes attrs,
                         org.apache.xerces.xni.Augmentations augs)
                  throws org.apache.xerces.xni.XNIException
Start element.

Specified by:
startElement in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

emptyElement

public void emptyElement(org.apache.xerces.xni.QName element,
                         org.apache.xerces.xni.XMLAttributes attrs,
                         org.apache.xerces.xni.Augmentations augs)
                  throws org.apache.xerces.xni.XNIException
Empty element.

Specified by:
emptyElement in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

characters

public void characters(org.apache.xerces.xni.XMLString text,
                       org.apache.xerces.xni.Augmentations augs)
                throws org.apache.xerces.xni.XNIException
Characters.

Specified by:
characters in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

ignorableWhitespace

public void ignorableWhitespace(org.apache.xerces.xni.XMLString text,
                                org.apache.xerces.xni.Augmentations augs)
                         throws org.apache.xerces.xni.XNIException
Ignorable whitespace.

Specified by:
ignorableWhitespace in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

startGeneralEntity

public void startGeneralEntity(java.lang.String name,
                               org.apache.xerces.xni.XMLResourceIdentifier id,
                               java.lang.String encoding,
                               org.apache.xerces.xni.Augmentations augs)
                        throws org.apache.xerces.xni.XNIException
Start general entity.

Specified by:
startGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

textDecl

public void textDecl(java.lang.String version,
                     java.lang.String encoding,
                     org.apache.xerces.xni.Augmentations augs)
              throws org.apache.xerces.xni.XNIException
Text declaration.

Specified by:
textDecl in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

endGeneralEntity

public void endGeneralEntity(java.lang.String name,
                             org.apache.xerces.xni.Augmentations augs)
                      throws org.apache.xerces.xni.XNIException
End general entity.

Specified by:
endGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

startCDATA

public void startCDATA(org.apache.xerces.xni.Augmentations augs)
                throws org.apache.xerces.xni.XNIException
Start CDATA section.

Specified by:
startCDATA in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

endCDATA

public void endCDATA(org.apache.xerces.xni.Augmentations augs)
              throws org.apache.xerces.xni.XNIException
End CDATA section.

Specified by:
endCDATA in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

endElement

public void endElement(org.apache.xerces.xni.QName element,
                       org.apache.xerces.xni.Augmentations augs)
                throws org.apache.xerces.xni.XNIException
End element.

Specified by:
endElement in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException

endDocument

public void endDocument(org.apache.xerces.xni.Augmentations augs)
                 throws org.apache.xerces.xni.XNIException
End document.

Specified by:
endDocument in interface org.apache.xerces.xni.XMLDocumentHandler
org.apache.xerces.xni.XNIException


(C) Copyright 2002-2003, Andy Clark. All rights reserved.