Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.meterware.httpunit.parsing
Class HTMLParserFactory  view HTMLParserFactory download HTMLParserFactory.java

java.lang.Object
  extended bycom.meterware.httpunit.parsing.HTMLParserFactory

public abstract class HTMLParserFactory
extends java.lang.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

Field Summary
private static HTMLParser _htmlParser
           
private static HTMLParser _jtidyParser
           
private static java.util.Vector _listeners
           
private static HTMLParser _nekoParser
           
private static boolean _parserWarningsEnabled
           
private static boolean _preserveTagCase
           
private static boolean _returnHTMLDocument
           
 
Constructor Summary
HTMLParserFactory()
           
 
Method Summary
static void addHTMLParserListener(HTMLParserListener el)
          Add an HTML Parser listener.
static HTMLParser getHTMLParser()
          Returns the current selected parser.
(package private) static java.util.Vector getHTMLParserListeners()
          Get the list of Html Error Listeners
static boolean isParserWarningsEnabled()
          Returns true if parser warnings are enabled.
static boolean isPreserveTagCase()
          Returns true if the current parser will preserve the case of HTML tags and attributes.
static boolean isReturnHTMLDocument()
          Returns true if the current parser will return an HTMLDocument object rather than a Document object.
private static HTMLParser loadParserIfSupported(java.lang.String testClassName, java.lang.String parserClassName)
           
static void removeHTMLParserListener(HTMLParserListener el)
          Remove an HTML Parser listener.
static void reset()
          Resets all settings to their default values.
static void setHTMLParser(HTMLParser htmlParser)
          Specifies the parser to use.
static void setParserWarningsEnabled(boolean enabled)
          If true, tells the parser to display warning messages.
static void setPreserveTagCase(boolean preserveTagCase)
          Specifies whether the parser should preserve the case of HTML tags and attributes.
static void setReturnHTMLDocument(boolean returnHTMLDocument)
          Specifies whether the parser should return an HTMLDocument object rather than a Document object.
static void useJTidyParser()
          Selects the JTidy parser, if present.
static void useNekoHTMLParser()
          Selects the NekoHTML parser, if present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_listeners

private static java.util.Vector _listeners

_jtidyParser

private static HTMLParser _jtidyParser

_nekoParser

private static HTMLParser _nekoParser

_htmlParser

private static HTMLParser _htmlParser

_preserveTagCase

private static boolean _preserveTagCase

_returnHTMLDocument

private static boolean _returnHTMLDocument

_parserWarningsEnabled

private static boolean _parserWarningsEnabled
Constructor Detail

HTMLParserFactory

public HTMLParserFactory()
Method Detail

reset

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


useJTidyParser

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


useNekoHTMLParser

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


setHTMLParser

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


getHTMLParser

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


isPreserveTagCase

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


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.


isReturnHTMLDocument

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


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.


isParserWarningsEnabled

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


setParserWarningsEnabled

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


removeHTMLParserListener

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


addHTMLParserListener

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


getHTMLParserListeners

static java.util.Vector getHTMLParserListeners()
Get the list of Html Error Listeners


loadParserIfSupported

private static HTMLParser loadParserIfSupported(java.lang.String testClassName,
                                                java.lang.String parserClassName)