Package com.meterware.httpunit.parsing
Class HTMLParserFactory
- java.lang.Object
-
- com.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
- Author:
- Russell Gold, Bernhard Wagner
-
-
Constructor Summary
Constructors Constructor Description HTMLParserFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addHTMLParserListener(HTMLParserListener el)
Add an HTML Parser listener.static boolean
getForceLowerCase()
Return true if the current parser will support forcing the tags and attributes to lower casestatic boolean
getForceUpperCase()
Return true if the current parser will support forcing the tags and attributes to upper casestatic HTMLParser
getHTMLParser()
Returns the current selected parser.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.static void
removeHTMLParserListener(HTMLParserListener el)
Remove an HTML Parser listener.static void
reset()
Resets all settings to their default values.static void
setForceLowerCase(boolean forceLower)
Specifies whether the parser should force the case of HTML tags and attributes to lower case.static void
setForceUpperCase(boolean forceUpper)
Specifies whether the parser should force the case of HTML tags and attributes to be upper case.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.
-
-
-
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. override any previous behaviour configured by callingsetForceUpperCase(boolean)
orsetForceLowerCase(boolean)
-
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. and/or the forcing of the tag case to upper or lower case.
-
setForceUpperCase
public static void setForceUpperCase(boolean forceUpper)
Specifies whether the parser should force the case of HTML tags and attributes to be upper case. Not every parser can support this capability. Note that enabling this will disable support for the HTMLDocument class and override any previous behaviour configured by enablingsetPreserveTagCase(boolean)
orsetForceLowerCase(boolean)
- Parameters:
forceUpper
- boolean indicating whether to enable this functionality- See Also:
setReturnHTMLDocument(boolean)
,setPreserveTagCase(boolean)
,setForceLowerCase(boolean)
-
getForceUpperCase
public static boolean getForceUpperCase()
Return true if the current parser will support forcing the tags and attributes to upper case- Returns:
- boolean flag
-
setForceLowerCase
public static void setForceLowerCase(boolean forceLower)
Specifies whether the parser should force the case of HTML tags and attributes to lower case. Not every parser can support this capability. Note that enabling this will disable support for the HTMLDocument class and override any previous behaviour configured by enablingsetPreserveTagCase(boolean)
orsetForceUpperCase(boolean)
- Parameters:
forceLower
- boolean indicating whether to enable this functionality- See Also:
setReturnHTMLDocument(boolean)
,setPreserveTagCase(boolean)
,setForceUpperCase(boolean)
-
getForceLowerCase
public static boolean getForceLowerCase()
Return true if the current parser will support forcing the tags and attributes to lower case- Returns:
- boolean flag
-
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.
-
-