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.

转载于:https://www.cnblogs.com/yigui/p/7274728.html

HtmlCleaner CleanerProperties 参数配置(转自macken博客,链接:http://macken.iteye.com/blog/1579809)...相关推荐

  1. 如何在简历中添加自己的CSDN博客链接

    如何在简历中添加自己的CSDN博客链接 添加以下网址https://blog.csdn.net/ID(ID为 ) 点开就是自己的博客

  2. 使用async批量获取博客链接

    主要使用了superagent  cheerio  async 目的获取所有的博客链接,需要的参数有 博客地址 以及 总页码 let superagent = require('superagent' ...

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

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

  4. 几个非常有用的iOS学习博客链接

    几个非常有用的iOS学习博客链接 请仔细阅读相关链接下的其他博客的文章: http://blog.csdn.net/sanpintian/article/details/7402853 http:// ...

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

    博客搬家到CSDN:http://blog.csdn.net/yeweiouyang 转载于:https://www.cnblogs.com/yewei/p/4012571.html

  6. 大数据Q1741班女孩们的技术博客链接

    这里是大数据Q1741班女孩们的技术博客链接小屋~ 内容如下: 1.童璐: https://blog.csdn.net/qq_44704609 2.张沁晗: https://blog.csdn.net ...

  7. 收藏的技术博客链接(不断更新)

    这里收藏了一些不错的的技术博客和文章的链接,供平时学习和参考,经常看看还是很有收获的.链接列表会不定时更新,列在这里就当是书的目录了. (1)技术文章系列: 前端技术:http://www.cnblo ...

  8. ZUST ACM 学生博客链接【浙江科技学院】

    ZUST AMC 学生博客链接[浙江科技学院] 大家请评论把自己的博客地址贴在下面

  9. 解决:写的CSDN博客百度搜索不到 (网站/博客/链接 提交百度检索方法)

    往往发布了一篇博客,会发现按照博客标题搜索,无法在百度搜索到自己的这篇文章. 这时,我们在以下网站提交我们的博客链接即可: 链接提交_加快网站内容抓取,快速提交数据工具_站长工具_网站支持_百度搜索资 ...

最新文章

  1. pageResponse - 让H5适配移动设备全家(移动端适配)1
  2. ASP.NET中App_Code,App_Data等文件夹的作用转
  3. Flutter 填坑之 表单数据哪里去了?
  4. 干货整理:处理不平衡数据的技巧总结!收好不谢
  5. 解决IE6透明PNG图片的代码
  6. 大势所趋与各具特色 超融合市场玩家大盘点
  7. 【jvm】java jvm 报错 OutOfMemoryError: GC overhead limit exceeded
  8. 系统学习NLP(二十五)--语种识别landID
  9. tomcat 配置https 访
  10. jstack简单使用,定位死循环、线程阻塞、死锁等问题
  11. 《如何学商学》及听课感想
  12. css样式给标签加上小手图标
  13. html p 标签文字换行与不换行以及文字隐藏
  14. 怎么用微信打开wifi连接到服务器,微信一键连wifi在哪里 微信一键连wifi怎么使用...
  15. eclipse 编译Android,如何用eclipse编写android程序
  16. 计算机硬件的组装硬盘,组装电脑如何选择硬盘?DIY装机四种电脑硬盘搭配方案提供参考...
  17. 短信验证码是什么?在网站中起到什么作用?
  18. linux setlocale函数,linux中的多语言环境(LC_ALL, LANG, locale)
  19. 监控摄像头的测试方法
  20. 弥散阴影html,设计弥散阴影效果海报图片的PS实例教程

热门文章

  1. js基础代码大全_关于前端业务代码的一些见解
  2. js鼠标事件大全-Javascript鼠标事件大全
  3. android banner 高度,Android Banner 的简单使用步骤
  4. 小程序用php的优势,小程序的特点及优势?
  5. 计算生物学_01机器学习理论部分
  6. Pan JiaPu/ A real-time QRS detection algorithm
  7. C#记事本的简单开发
  8. 搜索引擎优化的用乐云seo_搜索引擎优化SEO
  9. MCU——矩阵键盘扫描问题记录
  10. C语言:对包含10个整数的数组进行如下的操作,从下标为0的元素开始到最后一个元素,依次向前移动一个位置。