com.meterware.httpunit.parsing

Class HTMLParserFactory

public abstract class HTMLParserFactory extends Object

Factory for creating HTML parsers. Parser customization properties can be specified but do not necessarily work for every parser type.

Since: 1.5.2

Author: Russell Gold Bernhard Wagner

Method Summary
static voidaddHTMLParserListener(HTMLParserListener el)
Add an HTML Parser listener.
static HTMLParsergetHTMLParser()
Returns the current selected parser.
static booleanisParserWarningsEnabled()
Returns true if parser warnings are enabled.
static booleanisPreserveTagCase()
Returns true if the current parser will preserve the case of HTML tags and attributes.
static booleanisReturnHTMLDocument()
Returns true if the current parser will return an HTMLDocument object rather than a Document object.
static voidremoveHTMLParserListener(HTMLParserListener el)
Remove an HTML Parser listener.
static voidreset()
Resets all settings to their default values.
static voidsetHTMLParser(HTMLParser htmlParser)
Specifies the parser to use.
static voidsetParserWarningsEnabled(boolean enabled)
If true, tells the parser to display warning messages.
static voidsetPreserveTagCase(boolean preserveTagCase)
Specifies whether the parser should preserve the case of HTML tags and attributes.
static voidsetReturnHTMLDocument(boolean returnHTMLDocument)
Specifies whether the parser should return an HTMLDocument object rather than a Document object.
static voiduseJTidyParser()
Selects the JTidy parser, if present.
static voiduseNekoHTMLParser()
Selects the NekoHTML parser, if present.

Method Detail

addHTMLParserListener

public static void addHTMLParserListener(HTMLParserListener el)
Add an HTML Parser listener.

getHTMLParser

public static HTMLParser getHTMLParser()
Returns the current selected parser.

isParserWarningsEnabled

public static boolean isParserWarningsEnabled()
Returns true if parser warnings are enabled.

isPreserveTagCase

public static boolean isPreserveTagCase()
Returns true if the current parser will preserve the case of HTML tags and attributes.

isReturnHTMLDocument

public static boolean isReturnHTMLDocument()
Returns true if the current parser will return an HTMLDocument object rather than a Document object.

removeHTMLParserListener

public static void removeHTMLParserListener(HTMLParserListener el)
Remove an HTML Parser listener.

reset

public static void reset()
Resets all settings to their default values. This includes the parser selection.

setHTMLParser

public static void setHTMLParser(HTMLParser htmlParser)
Specifies the parser to use.

setParserWarningsEnabled

public static void setParserWarningsEnabled(boolean enabled)
If true, tells the parser to display warning messages. The default is false (warnings are not shown).

setPreserveTagCase

public static void setPreserveTagCase(boolean preserveTagCase)
Specifies whether the parser should preserve the case of HTML tags and attributes. Not every parser can support this capability. Note that enabling this will disable support for the HTMLDocument class.

See Also: HTMLParserFactory

setReturnHTMLDocument

public static void setReturnHTMLDocument(boolean returnHTMLDocument)
Specifies whether the parser should return an HTMLDocument object rather than a Document object. Not every parser can support this capability. Note that enabling this will disable preservation of tag case.

See Also: HTMLParserFactory

useJTidyParser

public static void useJTidyParser()
Selects the JTidy parser, if present.

useNekoHTMLParser

public static void useNekoHTMLParser()
Selects the NekoHTML parser, if present.