Class Config
- java.lang.Object
-
- Config
-
public final class Config extends java.lang.ObjectEncapsulates global configuration properties which determine the behaviour of various functions.All of the properties in this class are static, affecting all objects and threads. Multiple concurrent configurations are not possible.
Properties that relate to user agent compatibility issues are stored in instances of the
Config.CompatibilityModeclass. This allows all of the properties in the compatibility mode to be set as a block by setting the staticCurrentCompatibilityModeproperty to a different instance.- See Also:
Config.CompatibilityMode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfig.CompatibilityModeRepresents a set of configuration parameters that relate to user agent compatibility issues.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringColumnMultipleValueSeparatorDetermines the string used to separate a single column's multiple values in the output of theFormFields.getColumnValues(Map)method.static java.lang.StringColumnValueFalseDetermines the string that represents the valuefalsein the output of theFormFields.getColumnValues(Map)method.static java.lang.StringColumnValueTrueDetermines the string that represents the valuetruein the output of theFormFields.getColumnValues(Map)method.static booleanConvertNonBreakingSpacesDetermines whether theCharacterReference.decode(CharSequence)and similar methods convert non-breaking space ( ) character references to normal spaces.static Config.CompatibilityModeCurrentCompatibilityModeDetermines the currently active compatibility mode.static booleanIsApostropheEncodedDetermines whether apostrophes are encoded when calling theCharacterReference.encode(CharSequence)method.static booleanIsHTMLEmptyElementTagRecognisedDetermines whether all empty-element tags are recognised.static LoggerProviderLoggerProviderDetermines theLoggerProviderthat is used to create the defaultLoggerobject for each newSourceobject.static java.lang.StringNewLineDetermines the string used to represent a newline in text output throughout the library.
-
-
-
Field Detail
-
ColumnMultipleValueSeparator
public static java.lang.String ColumnMultipleValueSeparator
Determines the string used to separate a single column's multiple values in the output of theFormFields.getColumnValues(Map)method.The situation where a single column has multiple values only arises if
FormField.getUserValueCount()>1on the relevant form field, which usually indicates a poorly designed form.The default value is "
," (a comma, not including the quotes).Must not be
null.
-
ColumnValueTrue
public static java.lang.String ColumnValueTrue
Determines the string that represents the valuetruein the output of theFormFields.getColumnValues(Map)method.The default value is "
true" (without the quotes).Must not be
null.
-
ColumnValueFalse
public static java.lang.String ColumnValueFalse
Determines the string that represents the valuefalsein the output of theFormFields.getColumnValues(Map)method.The default value is
null, which represents no output at all.
-
ConvertNonBreakingSpaces
public static boolean ConvertNonBreakingSpaces
Determines whether theCharacterReference.decode(CharSequence)and similar methods convert non-breaking space ( ) character references to normal spaces.The default value is
true.When this property is set to
false, non-breaking space ( ) character references are decoded as non-breaking space characters (U+00A0) instead of being converted to normal spaces (U+0020).The default behaviour of the library reflects the fact that non-breaking space character references are almost always used in HTML documents as a non-collapsing white space character. Converting them to the correct character code U+00A0, which is represented by a visible character in many older character sets, was confusing to most users who expected to see only normal spaces. The most common example of this is its visualisation as the character á in the MS-DOS CP437 character set.
The functionality of the following methods is affected:
CharacterReference.appendCharTo(Appendable)CharacterReference.decode(CharSequence)CharacterReference.decode(CharSequence, boolean insideAttributeValue)CharacterReference.decodeCollapseWhiteSpace(CharSequence)CharacterReference.reencode(CharSequence)Attribute.getValue()Attributes.getValue(String name)Attributes.populateMap(Map, boolean convertNamesToLowerCase)StartTag.getAttributeValue(String attributeName)Element.getAttributeValue(String attributeName)FormControl.getPredefinedValues()OutputDocument.replace(Attributes, boolean convertNamesToLowerCase)Renderer.getConvertNonBreakingSpaces()TextExtractor.getConvertNonBreakingSpaces()
-
CurrentCompatibilityMode
public static Config.CompatibilityMode CurrentCompatibilityMode
Determines the currently active compatibility mode.The default setting is
Config.CompatibilityMode.IE(MS Internet Explorer 6.0).Must not be
null.
-
IsApostropheEncoded
public static boolean IsApostropheEncoded
Determines whether apostrophes are encoded when calling theCharacterReference.encode(CharSequence)method.A value of
falsemeans apostrophe (U+0027) characters are not encoded. The only time apostrophes need to be encoded is within an attribute value delimited by single quotes (apostrophes), so in most cases ignoring apostrophes is perfectly safe and enhances the readability of the source document.Note that apostrophes are always encoded as a numeric character reference, never as the character entity reference
'.The default value is
false.
-
IsHTMLEmptyElementTagRecognised
public static boolean IsHTMLEmptyElementTagRecognised
Determines whether all empty-element tags are recognised.The major browsers do not recognise empty-element tags (those having the characters "/>" at the end of the start tag) if the element is defined by the HTML specification to have a required or an optional end tag. This is the case even in XHTML documents, which can cause a lot of confusion.
Setting this property to
trueforces the parser to recognise all syntactical empty-element tags, regardless of whether the element is defined by the HTML specification to have a required or optional end tag.Use of this feature is however not recommended as it makes the parser behaviour inconsistent with that of most browsers.
The default value is
false.- See Also:
StartTag.isEmptyElementTag()
-
LoggerProvider
public static LoggerProvider LoggerProvider
Determines theLoggerProviderthat is used to create the defaultLoggerobject for each newSourceobject.The
LoggerProviderinterface contains several predefinedLoggerProviderinstances which this property can be set to, mostly representing wrappers to common logging frameworks.The default value is
null, which results in the auto-detection of the most appropriate logging mechanism according to the following algorithm:- If the class
org.slf4j.impl.StaticLoggerBinderis detected:- If the class
org.slf4j.impl.JDK14LoggerFactoryis detected, useLoggerProvider.JAVA. - If the class
org.slf4j.impl.Log4jLoggerFactoryis detected, useLoggerProvider.LOG4J. - If the class
org.slf4j.impl.JCLLoggerFactoryis NOT detected, useLoggerProvider.SLF4J.
- If the class
- If the class
org.apache.commons.logging.Logis detected:Create an instance of it using the commons-logging
LogFactoryclass.- If the created
Logis of typeorg.apache.commons.logging.impl.Jdk14Logger, useLoggerProvider.JAVA. - If the created
Logis of typeorg.apache.commons.logging.impl.Log4JLogger, useLoggerProvider.LOG4J. - otherwise, use
LoggerProvider.JCL.
- If the created
- If the class
org.apache.log4j.Loggeris detected, useLoggerProvider.LOG4J. - otherwise, use
LoggerProvider.JAVA.
- See Also:
Source.setLogger(Logger)
- If the class
-
NewLine
public static java.lang.String NewLine
Determines the string used to represent a newline in text output throughout the library.The default value is the standard new line character sequence of the host platform, determined by
System.getProperty("line.separator").
-
-