HtmlCleaner CleanerProperties 参数配置

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 CleanerProperties 参数配置(转自macken博客,链接:http://macken.iteye.com/blog/1579809)的更多相关文章

  1. 文顶顶iOS开发博客链接整理及部分项目源代码下载

    文顶顶iOS开发博客链接整理及部分项目源代码下载   网上的iOS开发的教程很多,但是像cnblogs博主文顶顶的博客这样内容图文并茂,代码齐全,示例经典,原理也有阐述,覆盖面宽广,自成系统的系列教程 ...

  2. 所有博客已经迁移到个人空间 blog.scjia.cc

    所有博客已经迁移到个人空间 blog.scjia.cc

  3. 博客搬家到CSDN:http://blog.csdn.net/yeweiouyang

    博客搬家到CSDN:http://blog.csdn.net/yeweiouyang

  4. Beta版本冲刺计划及安排(附七天冲刺的博客链接)

    Beta版本冲刺计划及安排(附七天冲刺的博客链接) 新增组员 本次换人加入我们团队的新成员是原"爸爸说的都队"的队长念其锋同学,经过我们小组严格的两轮面试,他从几个同样前来面试的同 ...

  5. 《团队作业》五小福团队--UNO的博客链接汇总

    <团队作业>五小福团队--UNO的博客链接汇总 <团队作业第一周>五小福团队作业--UNO <团队作业第二周>五小福团队作业--UNO <团队作业第三.第四周 ...

  6. 团队Alpha博客链接目录

    Dipper团队Alpha博客链接目录 团队Alpha冲刺博客 第一次冲刺 第二次冲刺 第三次冲刺 第四次冲刺 第五次冲刺 第六次冲刺 第七次冲刺 第八次冲刺 第九次冲刺 第十次冲刺 第十一次冲刺 第 ...

  7. Alpha阶段博客链接

    博客链接 团队项目启程篇章:http://www.cnblogs.com/liuliudashun/p/5968194.html 团队项目开发篇章1:http://www.cnblogs.com/li ...

  8. Golang拼接字符串的5种方法及其效率_Chrispink-CSDN博客_golang 字符串拼接效率 https://blog.csdn.net/m0_37422289/article/details/103362740

    Different ways to concatenate two strings in Golang - GeeksforGeeks https://www.geeksforgeeks.org/di ...

  9. 配置WindowsLiveWriter,写cnblogs博客

    转载:http://www.haogongju.net/art/2307587 引言 以前写博客一般都是联网在cnblogs上面写,不好的地方就是不联网就写不了,当然我们也可以先记录在word文件,等 ...

随机推荐

  1. (1)认识javascript

    认识javascript 在本篇学习资料中,讲解javascript的基本概念.编写工具.在html中的使用: JavaScript 是脚本语言,这门语言可用于 HTML 和 web,更可广泛用于服务 ...

  2. 持续集成篇-- SonarQube代码质量管理平台的配置与使用

    样例视频教程:http://www.roncoo.com/course/view/85d6008fe77c4199b0cdd2885eaeee53 一.SonarQube的配置(前提,先用admin用 ...

  3. [leetcode-572-Subtree of Another Tree]

    Given two non-empty binary trees s and t, check whether tree t hasexactly the same structure and nod ...

  4. vijos1056题解

    题目: 桌面上放了N个平行于坐标轴的矩形,这N个矩形可能有互相覆盖的部分,求它们组成的图形的面积. 在翻题目时,偶然发现了这道标号为WA的题目. 原来,以前我把一中培训的代码发了上去,却WA了4个点, ...

  5. spa单页面应用(angular)

    本篇文章是对单页面的一个简单的基本逻辑操作,这个方法可以搭建基本的单页面的逻辑结构. 简单理解:单页面应用,锚点值切换,一个路由对应一个页面. 路由:此时会创建一个信息保存路由的信息,之后对页面a标签 ...

  6. JavaScript一个函数式编程-------求标准差

    利用JavaScript中的map函数和reduce函数实现函数式编程. 注意: 输出都在浏览器的控制台中. 代码如下: <script type="text/javascript&q ...

  7. CJOJ 1010【NOIP2003】加分二叉树 / Luogu 1040 加分二叉树(树型动态规划)

    CJOJ 1010[NOIP2003]加分二叉树 / Luogu 1040 加分二叉树(树型动态规划) Description 设 一个 n 个节点的二叉树 tree 的中序遍历为( 1,2,3,-, ...

  8. Javascript百学不厌-递归

    虽然偶尔也用过,但是从来没具体来整理过 普通递归: function fac(n) { ) ; ); } fac() 这是个阶乘.但是占用内存,因为: fac(5) (5*fac(4)) (5*(4* ...

  9. 初次入坑jade模板引擎(一)

    最近由于工作需要全栈开发,nodejs做后端,在写一个后台管理系统的时候,我一直在考虑用怎样的方式去写,尝试过依然采用前后端分离的结构.使用json数据进行数据交互的模式,但是尝试过才知道,真的很花时 ...

  10. css3-transition过渡属性

    transition主要是用于一个元素的一种状态到另一种状态的一个过渡的过程,不能够主动触发,必须依赖于事件,例如hover伪类选择器. 一,transition简写 transition:要过渡的属 ...