Class HtmlParser
- java.lang.Object
-
- nu.validator.htmlparser.sax.HtmlParser
-
- All Implemented Interfaces:
org.xml.sax.XMLReader
- Direct Known Subclasses:
InfosetCoercingHtmlParser
public class HtmlParser extends java.lang.Object implements org.xml.sax.XMLReaderThis class implements an HTML5 parser that exposes data through the SAX2 interface.By default, when using the constructor without arguments, the this parser coerces XML 1.0-incompatible infosets into XML 1.0-compatible infosets. This corresponds to
ALTER_INFOSETas the general XML violation policy. To make the parser support non-conforming HTML fully per the HTML 5 spec while on the other hand potentially violating the SAX2 API contract, set the general XML violation policy toALLOW. It is possible to treat XML 1.0 infoset violations as fatal by setting the general XML violation policy toFATAL.By default, this parser doesn't do true streaming but buffers everything first. The parser can be made truly streaming by calling
setStreamabilityViolationPolicy(XmlViolationPolicy.FATAL). This has the consequence that errors that require non-streamable recovery are treated as fatal.By default, in order to make the parse events emulate the parse events for a DTDless XML document, the parser does not report the doctype through
LexicalHandler. Doctype reporting throughLexicalHandlercan be turned on by callingsetReportingDoctype(true).- Version:
- $Id$
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description HtmlParser()Instantiates the parser with a fatal XML violation policy.HtmlParser(XmlViolationPolicy xmlPolicy)Instantiates the parser with a specific XML violation policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCharacterHandler(CharacterHandler characterHandler)XmlViolationPolicygetBogusXmlnsPolicy()Deprecated.XmlViolationPolicygetCommentPolicy()Returns the commentPolicy.org.xml.sax.ContentHandlergetContentHandler()XmlViolationPolicygetContentNonXmlCharPolicy()Returns the contentNonXmlCharPolicy.XmlViolationPolicygetContentSpacePolicy()Returns the contentSpacePolicy.DoctypeExpectationgetDoctypeExpectation()Returns the doctype expectation.org.xml.sax.LocatorgetDocumentLocator()Returns theLocatorduring parse.DocumentModeHandlergetDocumentModeHandler()Returns the document mode handler.org.xml.sax.DTDHandlergetDTDHandler()org.xml.sax.EntityResolvergetEntityResolver()org.xml.sax.ErrorHandlergetErrorHandler()booleangetFeature(java.lang.String name)Exposes the configuration of the emulated XML parser as well as boolean-valued configuration without using non-XMLReadergetters directly.HeuristicsgetHeuristics()org.xml.sax.ext.LexicalHandlergetLexicalHandler()Returns the lexicalHandler.XmlViolationPolicygetNamePolicy()The policy for non-NCName element and attribute names.java.lang.ObjectgetProperty(java.lang.String name)AllowsXMLReader-level access to non-boolean valued getters.XmlViolationPolicygetStreamabilityViolationPolicy()Returns the streamabilityViolationPolicy.XmlViolationPolicygetXmlnsPolicy()Returns the xmlnsPolicy.booleanisCheckingNormalization()Indicates whether NFC normalization of source is being checked.booleanisHtml4ModeCompatibleWithXhtml1Schemata()Whether the HTML 4 mode reports boolean attributes in a way that repeats the name in the value.booleanisMappingLangToXmlLang()Whetherlangis mapped toxml:lang.booleanisReportingDoctype()Returns the reportingDoctype.booleanisScriptingEnabled()Whether the parser considers scripting to be enabled for noscript treatment.private voidlazyInit()This class wraps different tree builders depending on configuration.private TokenizernewTokenizer(TokenHandler handler, boolean newAttributesEachTime)voidparse(java.lang.String systemId)voidparse(org.xml.sax.InputSource input)voidparseFragment(org.xml.sax.InputSource input, java.lang.String context)Parses a fragment.voidsetBogusXmlnsPolicy(XmlViolationPolicy bogusXmlnsPolicy)Deprecated.voidsetCheckingNormalization(boolean enable)Toggles the checking of the NFC normalization of source.voidsetCommentPolicy(XmlViolationPolicy commentPolicy)Sets the policy for consecutive hyphens in comments.voidsetContentHandler(org.xml.sax.ContentHandler handler)voidsetContentNonXmlCharPolicy(XmlViolationPolicy contentNonXmlCharPolicy)Sets the policy for non-XML characters except white space.voidsetContentSpacePolicy(XmlViolationPolicy contentSpacePolicy)Sets the policy for non-XML white space.voidsetDoctypeExpectation(DoctypeExpectation doctypeExpectation)Sets the doctype expectation.voidsetDocumentModeHandler(DocumentModeHandler documentModeHandler)Sets the document mode handler.voidsetDTDHandler(org.xml.sax.DTDHandler handler)voidsetEntityResolver(org.xml.sax.EntityResolver resolver)voidsetErrorHandler(org.xml.sax.ErrorHandler handler)voidsetErrorProfile(java.util.HashMap<java.lang.String,java.lang.String> errorProfileMap)voidsetFeature(java.lang.String name, boolean value)Sets a boolean feature without having to use non-XMLReadersetters directly.voidsetHeuristics(Heuristics heuristics)Sets the encoding sniffing heuristics.voidsetHtml4ModeCompatibleWithXhtml1Schemata(boolean html4ModeCompatibleWithXhtml1Schemata)Whether the HTML 4 mode reports boolean attributes in a way that repeats the name in the value.voidsetLexicalHandler(org.xml.sax.ext.LexicalHandler handler)Sets the lexical handler.voidsetMappingLangToXmlLang(boolean mappingLangToXmlLang)Whetherlangis mapped toxml:lang.voidsetNamePolicy(XmlViolationPolicy namePolicy)The policy for non-NCName element and attribute names.voidsetProperty(java.lang.String name, java.lang.Object value)Sets a non-boolean property without having to use non-XMLReadersetters directly.voidsetReportingDoctype(boolean reportingDoctype)voidsetScriptingEnabled(boolean scriptingEnabled)Sets whether the parser considers scripting to be enabled for noscript treatment.voidsetStreamabilityViolationPolicy(XmlViolationPolicy streamabilityViolationPolicy)Sets the streamabilityViolationPolicy.voidsetTransitionHandler(TransitionHandler handler)voidsetTreeBuilderErrorHandlerOverride(org.xml.sax.ErrorHandler handler)Deprecated.For Validator.nu internal usevoidsetXmlnsPolicy(XmlViolationPolicy xmlnsPolicy)Whether thexmlnsattribute on the root element is passed to through.voidsetXmlPolicy(XmlViolationPolicy xmlPolicy)This is a catch-all convenience method for setting name, xmlns, content space, content non-XML char and comment policies in one go.private voidtokenize(org.xml.sax.InputSource is)
-
-
-
Field Detail
-
driver
private Driver driver
-
treeBuilder
private TreeBuilder<?> treeBuilder
-
saxStreamer
private SAXStreamer saxStreamer
-
saxTreeBuilder
private SAXTreeBuilder saxTreeBuilder
-
contentHandler
private org.xml.sax.ContentHandler contentHandler
-
lexicalHandler
private org.xml.sax.ext.LexicalHandler lexicalHandler
-
dtdHandler
private org.xml.sax.DTDHandler dtdHandler
-
entityResolver
private org.xml.sax.EntityResolver entityResolver
-
errorHandler
private org.xml.sax.ErrorHandler errorHandler
-
documentModeHandler
private DocumentModeHandler documentModeHandler
-
doctypeExpectation
private DoctypeExpectation doctypeExpectation
-
checkingNormalization
private boolean checkingNormalization
-
scriptingEnabled
private boolean scriptingEnabled
-
characterHandlers
private final java.util.List<CharacterHandler> characterHandlers
-
contentSpacePolicy
private XmlViolationPolicy contentSpacePolicy
-
contentNonXmlCharPolicy
private XmlViolationPolicy contentNonXmlCharPolicy
-
commentPolicy
private XmlViolationPolicy commentPolicy
-
namePolicy
private XmlViolationPolicy namePolicy
-
streamabilityViolationPolicy
private XmlViolationPolicy streamabilityViolationPolicy
-
html4ModeCompatibleWithXhtml1Schemata
private boolean html4ModeCompatibleWithXhtml1Schemata
-
mappingLangToXmlLang
private boolean mappingLangToXmlLang
-
xmlnsPolicy
private XmlViolationPolicy xmlnsPolicy
-
reportingDoctype
private boolean reportingDoctype
-
treeBuilderErrorHandler
private org.xml.sax.ErrorHandler treeBuilderErrorHandler
-
heuristics
private Heuristics heuristics
-
errorProfileMap
private java.util.HashMap<java.lang.String,java.lang.String> errorProfileMap
-
transitionHandler
private TransitionHandler transitionHandler
-
-
Constructor Detail
-
HtmlParser
public HtmlParser()
Instantiates the parser with a fatal XML violation policy.
-
HtmlParser
public HtmlParser(XmlViolationPolicy xmlPolicy)
Instantiates the parser with a specific XML violation policy.- Parameters:
xmlPolicy- the policy
-
-
Method Detail
-
newTokenizer
private Tokenizer newTokenizer(TokenHandler handler, boolean newAttributesEachTime)
-
lazyInit
private void lazyInit()
This class wraps different tree builders depending on configuration. This method does the work of hiding this from the user of the class.
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
- Specified by:
getContentHandlerin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.getContentHandler()
-
getDTDHandler
public org.xml.sax.DTDHandler getDTDHandler()
- Specified by:
getDTDHandlerin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.getDTDHandler()
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
- Specified by:
getEntityResolverin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.getEntityResolver()
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
- Specified by:
getErrorHandlerin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.getErrorHandler()
-
getFeature
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionExposes the configuration of the emulated XML parser as well as boolean-valued configuration without using non-XMLReadergetters directly.http://xml.org/sax/features/external-general-entitiesfalsehttp://xml.org/sax/features/external-parameter-entitiesfalsehttp://xml.org/sax/features/is-standalonetruehttp://xml.org/sax/features/lexical-handler/parameter-entitiesfalsehttp://xml.org/sax/features/namespacestruehttp://xml.org/sax/features/namespace-prefixesfalsehttp://xml.org/sax/features/resolve-dtd-uristruehttp://xml.org/sax/features/string-interningfalsehttp://xml.org/sax/features/unicode-normalization-checkingisCheckingNormalizationhttp://xml.org/sax/features/use-attributes2falsehttp://xml.org/sax/features/use-locator2falsehttp://xml.org/sax/features/use-entity-resolver2falsehttp://xml.org/sax/features/validationfalsehttp://xml.org/sax/features/xmlns-urisfalsehttp://xml.org/sax/features/xml-1.1falsehttp://validator.nu/features/html4-mode-compatible-with-xhtml1-schemataisHtml4ModeCompatibleWithXhtml1Schematahttp://validator.nu/features/mapping-lang-to-xml-langisMappingLangToXmlLanghttp://validator.nu/features/scripting-enabledisScriptingEnabled
- Specified by:
getFeaturein interfaceorg.xml.sax.XMLReader- Parameters:
name- feature URI string- Returns:
- a value per the list above
- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException- See Also:
XMLReader.getFeature(java.lang.String)
-
getProperty
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionAllowsXMLReader-level access to non-boolean valued getters.The properties are mapped as follows:
http://xml.org/sax/properties/document-xml-version"1.0"http://xml.org/sax/properties/lexical-handlergetLexicalHandlerhttp://validator.nu/properties/content-space-policygetContentSpacePolicyhttp://validator.nu/properties/content-non-xml-char-policygetContentNonXmlCharPolicyhttp://validator.nu/properties/comment-policygetCommentPolicyhttp://validator.nu/properties/xmlns-policygetXmlnsPolicyhttp://validator.nu/properties/name-policygetNamePolicyhttp://validator.nu/properties/streamability-violation-policygetStreamabilityViolationPolicyhttp://validator.nu/properties/document-mode-handlergetDocumentModeHandlerhttp://validator.nu/properties/doctype-expectationgetDoctypeExpectationhttp://xml.org/sax/features/unicode-normalization-checking
- Specified by:
getPropertyin interfaceorg.xml.sax.XMLReader- Parameters:
name- property URI string- Returns:
- a value per the list above
- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException- See Also:
XMLReader.getProperty(java.lang.String)
-
parse
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
java.io.IOExceptionorg.xml.sax.SAXException- See Also:
XMLReader.parse(org.xml.sax.InputSource)
-
parseFragment
public void parseFragment(org.xml.sax.InputSource input, java.lang.String context) throws java.io.IOException, org.xml.sax.SAXExceptionParses a fragment.- Parameters:
input- the input to parsecontext- the name of the context element- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
tokenize
private void tokenize(org.xml.sax.InputSource is) throws org.xml.sax.SAXException, java.io.IOException, java.net.MalformedURLException- Parameters:
is-- Throws:
org.xml.sax.SAXExceptionjava.io.IOExceptionjava.net.MalformedURLException
-
parse
public void parse(java.lang.String systemId) throws java.io.IOException, org.xml.sax.SAXException- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
java.io.IOExceptionorg.xml.sax.SAXException- See Also:
XMLReader.parse(java.lang.String)
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
- Specified by:
setContentHandlerin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.setContentHandler(org.xml.sax.ContentHandler)
-
setLexicalHandler
public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Sets the lexical handler.- Parameters:
handler- the hander.
-
setDTDHandler
public void setDTDHandler(org.xml.sax.DTDHandler handler)
- Specified by:
setDTDHandlerin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
- Specified by:
setEntityResolverin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
- Specified by:
setErrorHandlerin interfaceorg.xml.sax.XMLReader- See Also:
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
-
setTransitionHandler
public void setTransitionHandler(TransitionHandler handler)
-
setTreeBuilderErrorHandlerOverride
public void setTreeBuilderErrorHandlerOverride(org.xml.sax.ErrorHandler handler)
Deprecated.For Validator.nu internal use- See Also:
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
-
setFeature
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSets a boolean feature without having to use non-XMLReadersetters directly.The supported features are:
http://xml.org/sax/features/unicode-normalization-checkingsetCheckingNormalizationhttp://validator.nu/features/html4-mode-compatible-with-xhtml1-schematasetHtml4ModeCompatibleWithXhtml1Schematahttp://validator.nu/features/mapping-lang-to-xml-langsetMappingLangToXmlLanghttp://validator.nu/features/scripting-enabledsetScriptingEnabled
- Specified by:
setFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException- See Also:
XMLReader.setFeature(java.lang.String, boolean)
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSets a non-boolean property without having to use non-XMLReadersetters directly.http://xml.org/sax/properties/lexical-handlersetLexicalHandlerhttp://validator.nu/properties/content-space-policysetContentSpacePolicyhttp://validator.nu/properties/content-non-xml-char-policysetContentNonXmlCharPolicyhttp://validator.nu/properties/comment-policysetCommentPolicyhttp://validator.nu/properties/xmlns-policysetXmlnsPolicyhttp://validator.nu/properties/name-policysetNamePolicyhttp://validator.nu/properties/streamability-violation-policysetStreamabilityViolationPolicyhttp://validator.nu/properties/document-mode-handlersetDocumentModeHandlerhttp://validator.nu/properties/doctype-expectationsetDoctypeExpectationhttp://validator.nu/properties/xml-policysetXmlPolicy
- Specified by:
setPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException- See Also:
XMLReader.setProperty(java.lang.String, java.lang.Object)
-
isCheckingNormalization
public boolean isCheckingNormalization()
Indicates whether NFC normalization of source is being checked.- Returns:
trueif NFC normalization of source is being checked.- See Also:
nu.validator.htmlparser.impl.Tokenizer#isCheckingNormalization()
-
setCheckingNormalization
public void setCheckingNormalization(boolean enable)
Toggles the checking of the NFC normalization of source.- Parameters:
enable-trueto check normalization- See Also:
nu.validator.htmlparser.impl.Tokenizer#setCheckingNormalization(boolean)
-
setCommentPolicy
public void setCommentPolicy(XmlViolationPolicy commentPolicy)
Sets the policy for consecutive hyphens in comments.- Parameters:
commentPolicy- the policy- See Also:
Tokenizer.setCommentPolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
-
setContentNonXmlCharPolicy
public void setContentNonXmlCharPolicy(XmlViolationPolicy contentNonXmlCharPolicy)
Sets the policy for non-XML characters except white space.- Parameters:
contentNonXmlCharPolicy- the policy- See Also:
Tokenizer.setContentNonXmlCharPolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
-
setContentSpacePolicy
public void setContentSpacePolicy(XmlViolationPolicy contentSpacePolicy)
Sets the policy for non-XML white space.- Parameters:
contentSpacePolicy- the policy- See Also:
Tokenizer.setContentSpacePolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
-
isScriptingEnabled
public boolean isScriptingEnabled()
Whether the parser considers scripting to be enabled for noscript treatment.- Returns:
trueif enabled- See Also:
TreeBuilder.isScriptingEnabled()
-
setScriptingEnabled
public void setScriptingEnabled(boolean scriptingEnabled)
Sets whether the parser considers scripting to be enabled for noscript treatment.- Parameters:
scriptingEnabled-trueto enable- See Also:
TreeBuilder.setScriptingEnabled(boolean)
-
getDoctypeExpectation
public DoctypeExpectation getDoctypeExpectation()
Returns the doctype expectation.- Returns:
- the doctypeExpectation
-
setDoctypeExpectation
public void setDoctypeExpectation(DoctypeExpectation doctypeExpectation)
Sets the doctype expectation.- Parameters:
doctypeExpectation- the doctypeExpectation to set- See Also:
TreeBuilder.setDoctypeExpectation(nu.validator.htmlparser.common.DoctypeExpectation)
-
getDocumentModeHandler
public DocumentModeHandler getDocumentModeHandler()
Returns the document mode handler.- Returns:
- the documentModeHandler
-
setDocumentModeHandler
public void setDocumentModeHandler(DocumentModeHandler documentModeHandler)
Sets the document mode handler.- Parameters:
documentModeHandler- the documentModeHandler to set- See Also:
TreeBuilder.setDocumentModeHandler(nu.validator.htmlparser.common.DocumentModeHandler)
-
getStreamabilityViolationPolicy
public XmlViolationPolicy getStreamabilityViolationPolicy()
Returns the streamabilityViolationPolicy.- Returns:
- the streamabilityViolationPolicy
-
setStreamabilityViolationPolicy
public void setStreamabilityViolationPolicy(XmlViolationPolicy streamabilityViolationPolicy)
Sets the streamabilityViolationPolicy.- Parameters:
streamabilityViolationPolicy- the streamabilityViolationPolicy to set
-
setHtml4ModeCompatibleWithXhtml1Schemata
public void setHtml4ModeCompatibleWithXhtml1Schemata(boolean html4ModeCompatibleWithXhtml1Schemata)
Whether the HTML 4 mode reports boolean attributes in a way that repeats the name in the value.- Parameters:
html4ModeCompatibleWithXhtml1Schemata-
-
getDocumentLocator
public org.xml.sax.Locator getDocumentLocator()
Returns theLocatorduring parse.- Returns:
- the
Locator
-
isHtml4ModeCompatibleWithXhtml1Schemata
public boolean isHtml4ModeCompatibleWithXhtml1Schemata()
Whether the HTML 4 mode reports boolean attributes in a way that repeats the name in the value.- Returns:
- the html4ModeCompatibleWithXhtml1Schemata
-
setMappingLangToXmlLang
public void setMappingLangToXmlLang(boolean mappingLangToXmlLang)
Whetherlangis mapped toxml:lang.- Parameters:
mappingLangToXmlLang-- See Also:
Tokenizer.setMappingLangToXmlLang(boolean)
-
isMappingLangToXmlLang
public boolean isMappingLangToXmlLang()
Whetherlangis mapped toxml:lang.- Returns:
- the mappingLangToXmlLang
-
setXmlnsPolicy
public void setXmlnsPolicy(XmlViolationPolicy xmlnsPolicy)
Whether thexmlnsattribute on the root element is passed to through. (FATAL not allowed.)- Parameters:
xmlnsPolicy-- See Also:
Tokenizer.setXmlnsPolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
-
getXmlnsPolicy
public XmlViolationPolicy getXmlnsPolicy()
Returns the xmlnsPolicy.- Returns:
- the xmlnsPolicy
-
getLexicalHandler
public org.xml.sax.ext.LexicalHandler getLexicalHandler()
Returns the lexicalHandler.- Returns:
- the lexicalHandler
-
getCommentPolicy
public XmlViolationPolicy getCommentPolicy()
Returns the commentPolicy.- Returns:
- the commentPolicy
-
getContentNonXmlCharPolicy
public XmlViolationPolicy getContentNonXmlCharPolicy()
Returns the contentNonXmlCharPolicy.- Returns:
- the contentNonXmlCharPolicy
-
getContentSpacePolicy
public XmlViolationPolicy getContentSpacePolicy()
Returns the contentSpacePolicy.- Returns:
- the contentSpacePolicy
-
setReportingDoctype
public void setReportingDoctype(boolean reportingDoctype)
- Parameters:
reportingDoctype-- See Also:
TreeBuilder.setReportingDoctype(boolean)
-
isReportingDoctype
public boolean isReportingDoctype()
Returns the reportingDoctype.- Returns:
- the reportingDoctype
-
setErrorProfile
public void setErrorProfile(java.util.HashMap<java.lang.String,java.lang.String> errorProfileMap)
- Parameters:
errorProfile-- See Also:
nu.validator.htmlparser.impl.errorReportingTokenizer#setErrorProfile(set)
-
setNamePolicy
public void setNamePolicy(XmlViolationPolicy namePolicy)
The policy for non-NCName element and attribute names.- Parameters:
namePolicy-- See Also:
Tokenizer.setNamePolicy(nu.validator.htmlparser.common.XmlViolationPolicy)
-
setHeuristics
public void setHeuristics(Heuristics heuristics)
Sets the encoding sniffing heuristics.- Parameters:
heuristics- the heuristics to set- See Also:
nu.validator.htmlparser.impl.Tokenizer#setHeuristics(nu.validator.htmlparser.common.Heuristics)
-
getHeuristics
public Heuristics getHeuristics()
-
setXmlPolicy
public void setXmlPolicy(XmlViolationPolicy xmlPolicy)
This is a catch-all convenience method for setting name, xmlns, content space, content non-XML char and comment policies in one go. This does not affect the streamability policy or doctype reporting.- Parameters:
xmlPolicy-
-
getNamePolicy
public XmlViolationPolicy getNamePolicy()
The policy for non-NCName element and attribute names.- Returns:
- the namePolicy
-
setBogusXmlnsPolicy
public void setBogusXmlnsPolicy(XmlViolationPolicy bogusXmlnsPolicy)
Deprecated.Does nothing.
-
getBogusXmlnsPolicy
public XmlViolationPolicy getBogusXmlnsPolicy()
Deprecated.ReturnsXmlViolationPolicy.ALTER_INFOSET.- Returns:
XmlViolationPolicy.ALTER_INFOSET
-
addCharacterHandler
public void addCharacterHandler(CharacterHandler characterHandler)
-
-