`
macken
  • 浏览: 341636 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

HtmlCleaner CleanerProperties 参数配置

    博客分类:
  • Java
 
阅读更多

 

Parameter

Default

Explanation

advancedXmlEscape

true

If this parameter is set to true, ampersand sign (&) that proceeds valid XML character sequences (&XXX;) will not be escaped with &XXX;

transResCharsToNCR

false

If this parameter is set to true, reserved XML sequences (&, ", &apos;, <, >) are serialized to their Numeric Character Representations (#&38;, #&34;, #&39;, #&60;, #&62;). This parameter has effect only if advancedXmlEscape is set to true.

translateSpecialEntities

true

If true, special HTML entities (i.e. ?, ¡ë, ¡Á) are replaced with unicode characters they represent (?, ¡ë, ¡Á). This doesn't include &, <, >, ", &apos;.

transSpecialEntitiesToNCR

false

If this parameter is set to true, special HTML entities (i.e. ¦¡) are serialized to their Numeric Character Representations (#&913;). This parameter has effect only if translateSpecialEntities is set to true.

recognizeUnicodeChars

true

If true, HTML characters represented by their codes in form &#XXXX; are replaced with real unicode characters (i.e. §Ø is replaced with §Ø)

useCdata

true

If true, HtmlCleaner will treat SCRIPT and STYLE tag contents as CDATA sections, or otherwise it will be regarded as ordinary text (special characters will be escaped).

omitUnknownTags

false

Tells whether to skip (ignore) unknown tags during cleanup.

treatUnknTagsAsContent

false

Tells whether to treat unknown tags as ordinary content, i.e. <something...> will be transformed to <something...>. This attribute is applicable only if omitUnknownTags is set to false.

omitDeprTags

false

Tells whether to skip (ignore) deprecated HTML tags during cleanup.

treatDeprTagsAsContent

false

Tells whether to treat deprecated tags as ordinary content, i.e. <font...> will be transformed to <font...>. This attribute is applicable only if omitDeprecatedTags is set to false.

omitComments

false

Tells whether to skip HTML comments.

omitXmlDeclaration

false

Tells whether or not to put XML declaration line at the beginning of the resulting XML.

omitDoctypeDeclaration

true

Tells whether to skip HTML declaration found in the source document. If HTML document being cleaned doesn't contain one it wouldn't be placed in the result anyway.

omitXmlnsAttributes

false

This flag is depricated since version 1.3 and namespacesAware should be used instead.

omitEnvelope

false

Tells whether to remove open and close tag being serialized. This parameter is introduced in HtmlCleaner 2.2 to replace omitHtmlEnvelope. If set to true, serialization skips open and close tags of the node, outputs only node's children.

useEmptyElementTags

true

Specifies how to serialize tags with empty body - if true, compact notation is used(<xxx/>), otherwise - <xxx></xxx>

allowMultiWordAttributes

true

Tells parser whether to allow attribute values consisting of multiple words or not. If true, attribute att="a b c" will stay like it is, and if false parser will split this into att="a" b="b" c="c" (this is default browsers' behaviour).

allowHtmlInsideAttributes

false

Tells parser whether to allow html tags inside attribute values. For example, when this flag is set att="here is <a href='xxxx'>link</a>" will stay like it is, and if not, parser will end attribute value after "here is".
This flag makes sense only if allowMultiWordAttributes is set as well.

ignoreQuestAndExclam

true

Tells parser whether to completely ignore tags that have form <?TAGNAME....> or <!TAGNAME....>. This way some HTML/XML processing instructions may be omitted from the resulting xml.

namespacesAware

true

If true, namespace prefixes found during parsing will be preserved and all neccessery xml namespace declarations will be added in the root element. If false, all namespace prefixes and all xmlns namespace declarations will be stripped.

hyphenReplacement

=

XML doesn't allow double hyphen sequence (--) inside comments. This parameter tells which replacement to use for it when double hyphen is encountered during parsing.

pruneTags

empty string

Comma-separated list of tags that will be complitely removed (with all nested elements) from XML tree after parsing. For exampe if pruneTags is "script,style", resulting XML will not contain scripts and styles.

booleanAtts

self

Tells cleaner what value to give to boolean attributes, like checked, selected and similar. Allowed values are self - value of attribute is the same as attribute name (checked = "checked"), empty - attribute value is empty string (checked = "") and true - value of attribute is "true" (checked = "true").

nodeByXpath

 

XPath expression used to select first node that is going to be serialized instead of whole HTML document. For example if this parameter us set to //table[1] only first table in document will be serialized.

分享到:
评论

相关推荐

    HtmlCleaner

    HtmlCleaner是一个开源的Java语言的Html文档解析器。 HtmlCleaner能够重新整理HTML文档的每个元素并生成结构良好(Well-Formed)的 HTML 文档。默认它遵循的规则是类似于大部份web浏览器为创文档对象模型所使用的规则...

    htmlcleaner html解析器

    htmlcleaner html解析器htmlcleaner html解析器

    HtmlCleaner2.6.1 API (英文) 及 JAR Library

    HtmlCleaner2.6.1 API (英文) 及 JAR Library API LINK: http://htmlcleaner.sourceforge.net/doc/index.html

    htmlcleaner-2.2.4.jar

    网络爬虫htmlcleaner的jar包

    htmlcleaner html解析器2.2版

    htmlcleaner html解析器2.2版 ,解析速度很快的,比htmlparser1使用还速度快

    HtmlCleaner2.1API参考手册.chm

    HtmlCleaner2.1API参考手册.chm HtmlCleaner是一个把html解析为XML文档的Java程序库。 我试过,这是java世界中最快、最好、最小、最强大的Html解析库。 可以解析为DOM对象,然后使用其他的xml分析器进行分析。

    网页爬虫demo 带htmlcleaner jar包

    一个最简单的htmlcleaner扒网页内容,demo中以58种的一个页面为例,xpath请通过chrome浏览器控制台选中需要的内容后右击选择复制xpath 不喜勿喷,资源免费下载

    htmlcleaner-2.8.jar

    Java解析HTML利器 htmlcleaner2.8

    网页解析工具HTMLCleaner

    能清晰方便的找出网页中元素的对应关系,可以单独去掉某个tag标签及向里面添加页面元素

    htmlcleaner,活跃的.zip

    注意//htmlcleaner.sourceforge.net/从2.4版起的项目

    HTMLcleaner

    Java的HTML开源解析框架,可以用来提取Html文档里面的特定元素

    htmlcleaner2_1.jar

    html解析工具,支持xpath,简单方便

    HtmlCleaner 用法

    NULL 博文链接:https://z-one.iteye.com/blog/1172948

    HtmlCleaner使用说明文档

    HtmlCleaner使用说明文档, 全面,还有很多例子可以参考!有空多交流!

    htmlcleaner使用方法及xpath语法初探

    HtmlCleaner是一个开源的Java语言的Html文档解析器。HtmlCleaner能够重新整理HTML文档的每个元素并生成结构良好(Well-Formed)的 HTML 文档

    htmlcleaner-2.2

    HtmlCleaner是一个开源的Java语言的Html文档解析器。

    HTMLCleaner(HTML代码优化工具)V1.0官方英文免费版

    HTML优化工具(HTML Cleaner) V1.0免费版HTML Cleaner是一个方便和可靠的HTML优化工具,旨在从HTML文档中删除不必要的字符,如多余的空格,引号,可选结束标记,等等。

    htmlcleaner

    HTML网页解析,非常好的jar包!方便开发。

    页面正文提取htmlcleaner-2.8.jar

    HtmlCleanner HtmlCleaner极其短小精悍,源码一共只有260KB,并且速度惊人,只需要10毫秒左右就可以处理完HtmlParser需要300毫秒处理的Html页面。

    HtmlCleaner-开源

    HtmlCleaner是用Java编写HTML解析器。 它将遵循大多数网络浏览器使用的相同规则,将脏HTML转换为格式正确的XML。

Global site tag (gtag.js) - Google Analytics