HTMLConfiguration (NekoHTML 1.9.21-SNAPSHOT Implementation)
Date: 2014-03-11

org.cyberneko.html

## Class HTMLConfiguration

- java.lang.Object
- - ParserConfigurationSettings
  - - org.cyberneko.html.HTMLConfiguration

-     public class HTMLConfiguration
      extends ParserConfigurationSettings

  An XNI-based parser configuration that can be used to parse HTML documents. This configuration can be used directly in order to parse HTML documents or can be used in conjunction with any XNI based tools, such as the Xerces2 implementation.

  This configuration recognizes the following features:

  - http://cyberneko.org/html/features/augmentations
  - http://cyberneko.org/html/features/report-errors
  - http://cyberneko.org/html/features/report-errors/simple
  - http://cyberneko.org/html/features/balance-tags
  - and
  - the features supported by the scanner and tag balancer components.

  This configuration recognizes the following properties:

  - http://cyberneko.org/html/properties/names/elems
  - http://cyberneko.org/html/properties/names/attrs
  - http://cyberneko.org/html/properties/filters
  - http://cyberneko.org/html/properties/error-reporter
  - and
  - the properties supported by the scanner and tag balancer.

  For complete usage information, refer to the documentation.

  Version:
    $Id: HTMLConfiguration.java,v 1.9 2005/02/14 03:56:54 andyc Exp $
  Author:
    Andy Clark
  See Also:
    `HTMLScanner`, `HTMLTagBalancer`, `HTMLErrorReporter`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `HTMLConfiguration.ErrorReporter` Defines an error reporter for reporting HTML errors.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `AUGMENTATIONS` Include infoset augmentations.
    `protected static java.lang.String` | `BALANCE_TAGS` Balance tags.
    `protected static java.lang.String` | `ERROR_DOMAIN` Error domain.
    `protected static java.lang.String` | `ERROR_REPORTER` Error reporter.
    `protected boolean` | `fCloseStream` Stream opened by parser.
    `protected XMLDocumentHandler` | `fDocumentHandler` Document handler.
    `protected HTMLScanner` | `fDocumentScanner` Document scanner.
    `protected XMLDTDContentModelHandler` | `fDTDContentModelHandler` DTD content model handler.
    `protected XMLDTDHandler` | `fDTDHandler` DTD handler.
    `protected XMLEntityResolver` | `fEntityResolver` Entity resolver.
    `protected XMLErrorHandler` | `fErrorHandler` Error handler.
    `protected HTMLErrorReporter` | `fErrorReporter` Error reporter.
    `protected java.util.Vector` | `fHTMLComponents` Components.
    `protected static java.lang.String` | `FILTERS` Pipeline filters.
    `protected java.util.Locale` | `fLocale` Locale.
    `protected NamespaceBinder` | `fNamespaceBinder` Namespace binder.
    `protected HTMLTagBalancer` | `fTagBalancer` HTML tag balancer.
    `protected static java.lang.String` | `NAMES_ATTRS` Modify HTML attribute names: { "upper", "lower", "default" }.
    `protected static java.lang.String` | `NAMES_ELEMS` Modify HTML element names: { "upper", "lower", "default" }.
    `protected static java.lang.String` | `NAMESPACES` Namespaces.
    `protected static java.lang.String` | `REPORT_ERRORS` Report errors.
    `protected static java.lang.String` | `SIMPLE_ERROR_FORMAT` Simple report format.
    `protected static boolean` | `XERCES_2_0_0` Parser version is Xerces 2.0.0.
    `protected static boolean` | `XERCES_2_0_1` Parser version is Xerces 2.0.1.
    `protected static boolean` | `XML4J_4_0_x` Parser version is XML4J 4.0.x.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTMLConfiguration()` Default constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addComponent(HTMLComponent component)` Adds a component.
    `void` | `cleanup()` If the application decides to terminate parsing before the xml document is fully parsed, the application should call this method to free any resource allocated during parsing.
    `protected HTMLScanner` | `createDocumentScanner()`
    `void` | `evaluateInputSource(XMLInputSource inputSource)` EXPERIMENTAL: may change in next release Immediately evaluates an input source and add the new content (e.g.
    `XMLDocumentHandler` | `getDocumentHandler()` Returns the document handler.
    `XMLDTDContentModelHandler` | `getDTDContentModelHandler()` Returns the DTD content model handler.
    `XMLDTDHandler` | `getDTDHandler()` Returns the DTD handler.
    `XMLEntityResolver` | `getEntityResolver()` Returns the entity resolver.
    `XMLErrorHandler` | `getErrorHandler()` Returns the error handler.
    `java.util.Locale` | `getLocale()` Returns the locale.
    `void` | `parse(XMLInputSource source)` Parses a document.
    `void` | `pushInputSource(XMLInputSource inputSource)` Pushes an input source onto the current entity stack.
    `protected void` | `reset()` Resets the parser configuration.
    `void` | `setDocumentHandler(XMLDocumentHandler handler)` Sets the document handler.
    `void` | `setDTDContentModelHandler(XMLDTDContentModelHandler handler)` Sets the DTD content model handler.
    `void` | `setDTDHandler(XMLDTDHandler handler)` Sets the DTD handler.
    `void` | `setEntityResolver(XMLEntityResolver resolver)` Sets the entity resolver.
    `void` | `setErrorHandler(XMLErrorHandler handler)` Sets the error handler.
    `void` | `setFeature(java.lang.String featureId, boolean state)` Sets a feature.
    `void` | `setInputSource(XMLInputSource inputSource)` Sets the input source for the document to parse.
    `void` | `setLocale(java.util.Locale locale)` Sets the locale.
    `void` | `setProperty(java.lang.String propertyId, java.lang.Object value)` Sets a property.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NAMESPACES

          protected static final java.lang.String NAMESPACES

      Namespaces.
      See Also:
        Constant Field Values

    - #### AUGMENTATIONS

          protected static final java.lang.String AUGMENTATIONS

      Include infoset augmentations.
      See Also:
        Constant Field Values

    - #### REPORT_ERRORS

          protected static final java.lang.String REPORT_ERRORS

      Report errors.
      See Also:
        Constant Field Values

    - #### SIMPLE_ERROR_FORMAT

          protected static final java.lang.String SIMPLE_ERROR_FORMAT

      Simple report format.
      See Also:
        Constant Field Values

    - #### BALANCE_TAGS

          protected static final java.lang.String BALANCE_TAGS

      Balance tags.
      See Also:
        Constant Field Values

    - #### NAMES_ELEMS

          protected static final java.lang.String NAMES_ELEMS

      Modify HTML element names: { "upper", "lower", "default" }.
      See Also:
        Constant Field Values

    - #### NAMES_ATTRS

          protected static final java.lang.String NAMES_ATTRS

      Modify HTML attribute names: { "upper", "lower", "default" }.
      See Also:
        Constant Field Values

    - #### FILTERS

          protected static final java.lang.String FILTERS

      Pipeline filters.
      See Also:
        Constant Field Values

    - #### ERROR_REPORTER

          protected static final java.lang.String ERROR_REPORTER

      Error reporter.
      See Also:
        Constant Field Values

    - #### ERROR_DOMAIN

          protected static final java.lang.String ERROR_DOMAIN

      Error domain.
      See Also:
        Constant Field Values

    - #### fDocumentHandler

          protected XMLDocumentHandler fDocumentHandler

      Document handler.

    - #### fDTDHandler

          protected XMLDTDHandler fDTDHandler

      DTD handler.

    - #### fDTDContentModelHandler

          protected XMLDTDContentModelHandler fDTDContentModelHandler

      DTD content model handler.

    - #### fErrorHandler

          protected XMLErrorHandler fErrorHandler

      Error handler.

    - #### fEntityResolver

          protected XMLEntityResolver fEntityResolver

      Entity resolver.

    - #### fLocale

          protected java.util.Locale fLocale

      Locale.

    - #### fCloseStream

          protected boolean fCloseStream

      Stream opened by parser. Therefore, must close stream manually upon termination of parsing.

    - #### fHTMLComponents

          protected final java.util.Vector fHTMLComponents

      Components.

    - #### fDocumentScanner

          protected final HTMLScanner fDocumentScanner

      Document scanner.

    - #### fTagBalancer

          protected final HTMLTagBalancer fTagBalancer

      HTML tag balancer.

    - #### fNamespaceBinder

          protected final NamespaceBinder fNamespaceBinder

      Namespace binder.

    - #### fErrorReporter

          protected final HTMLErrorReporter fErrorReporter

      Error reporter.

    - #### XERCES_2_0_0

          protected static boolean XERCES_2_0_0

      Parser version is Xerces 2.0.0.

    - #### XERCES_2_0_1

          protected static boolean XERCES_2_0_1

      Parser version is Xerces 2.0.1.

    - #### XML4J_4_0_x

          protected static boolean XML4J_4_0_x

      Parser version is XML4J 4.0.x.

  - ### Constructor Detail

    - #### HTMLConfiguration

          public HTMLConfiguration()

      Default constructor.

  - ### Method Detail

    - #### createDocumentScanner

          protected HTMLScanner createDocumentScanner()

    - #### pushInputSource

          public void pushInputSource(XMLInputSource inputSource)

      Pushes an input source onto the current entity stack. This enables the scanner to transparently scan new content (e.g. the output written by an embedded script). At the end of the current entity, the scanner returns where it left off at the time this entity source was pushed.

      Hint: To use this feature to insert the output of <SCRIPT> tags, remember to buffer the entire output of the processed instructions before pushing a new input source. Otherwise, events may appear out of sequence.

      Parameters:
        `inputSource` - The new input source to start scanning.
      See Also:
        `evaluateInputSource(XMLInputSource)`

    - #### evaluateInputSource

          public void evaluateInputSource(XMLInputSource inputSource)

      EXPERIMENTAL: may change in next release
      Immediately evaluates an input source and add the new content (e.g. the output written by an embedded script).
      Parameters:
        `inputSource` - The new input source to start scanning.
      See Also:
        `pushInputSource(XMLInputSource)`

    - #### setFeature

          public void setFeature(java.lang.String featureId,
                        boolean state)
                          throws XMLConfigurationException

      Sets a feature.
      Throws:
        `XMLConfigurationException`

    - #### setProperty

          public void setProperty(java.lang.String propertyId,
                         java.lang.Object value)
                           throws XMLConfigurationException

      Sets a property.
      Throws:
        `XMLConfigurationException`

    - #### setDocumentHandler

          public void setDocumentHandler(XMLDocumentHandler handler)

      Sets the document handler.

    - #### getDocumentHandler

          public XMLDocumentHandler getDocumentHandler()

      Returns the document handler.

    - #### setDTDHandler

          public void setDTDHandler(XMLDTDHandler handler)

      Sets the DTD handler.

    - #### getDTDHandler

          public XMLDTDHandler getDTDHandler()

      Returns the DTD handler.

    - #### setDTDContentModelHandler

          public void setDTDContentModelHandler(XMLDTDContentModelHandler handler)

      Sets the DTD content model handler.

    - #### getDTDContentModelHandler

          public XMLDTDContentModelHandler getDTDContentModelHandler()

      Returns the DTD content model handler.

    - #### setErrorHandler

          public void setErrorHandler(XMLErrorHandler handler)

      Sets the error handler.

    - #### getErrorHandler

          public XMLErrorHandler getErrorHandler()

      Returns the error handler.

    - #### setEntityResolver

          public void setEntityResolver(XMLEntityResolver resolver)

      Sets the entity resolver.

    - #### getEntityResolver

          public XMLEntityResolver getEntityResolver()

      Returns the entity resolver.

    - #### setLocale

          public void setLocale(java.util.Locale locale)

      Sets the locale.

    - #### getLocale

          public java.util.Locale getLocale()

      Returns the locale.

    - #### parse

          public void parse(XMLInputSource source)
                     throws XNIException,
                            java.io.IOException

      Parses a document.
      Throws:
        `XNIException`
        `java.io.IOException`

    - #### setInputSource

          public void setInputSource(XMLInputSource inputSource)
                              throws XMLConfigurationException,
                                     java.io.IOException

      Sets the input source for the document to parse.
      Parameters:
        `inputSource` - The document's input source.
      Throws:
        `XMLConfigurationException` - Thrown if there is a configuration error when initializing the parser.
        `java.io.IOException` - Thrown on I/O error.
      See Also:
        `#parse(boolean)`

    - #### cleanup

          public void cleanup()

      If the application decides to terminate parsing before the xml document is fully parsed, the application should call this method to free any resource allocated during parsing. For example, close all opened streams.

    - #### addComponent

          protected void addComponent(HTMLComponent component)

      Adds a component.

    - #### reset

          protected void reset()
                        throws XMLConfigurationException

      Resets the parser configuration.
      Throws:
        `XMLConfigurationException`

(C) Copyright 2002-2014, Andy Clark, Marc Guillemot. All rights reserved.