Htmlparser Filter

Htmlparser Filter 简要归纳

 

1 . 逻辑关系:与或非

AndFilter() 
          Creates a new instance of an AndFilter.
AndFilter(NodeFilter[] predicates) 
          Creates an AndFilter that accepts nodes acceptable to all given filters.
AndFilter(NodeFilter left, NodeFilter right) 
          Creates an AndFilter that accepts nodes acceptable to both filters.

 

OrFilter() 
          Creates a new instance of an OrFilter.
OrFilter(NodeFilter[] predicates) 
          Creates an OrFilter that accepts nodes acceptable to any of the given filters.
OrFilter(NodeFilter left, NodeFilter right) 
          Creates an OrFilter that accepts nodes acceptable to either filter.

 

OrFilter() 
          Creates a new instance of an OrFilter.
OrFilter(NodeFilter[] predicates) 
          Creates an OrFilter that accepts nodes acceptable to any of the given filters.
OrFilter(NodeFilter left, NodeFilter right) 
          Creates an OrFilter that accepts nodes acceptable to either filter.

2. 内容

StringFilter:功能简单有限;复杂功能可使用RegexFilter (正则表达式)

StringFilter() 
          Creates a new instance of StringFilter that accepts all string nodes.
StringFilter(String pattern) 
          Creates a StringFilter that accepts text nodes containing a string.
StringFilter(String pattern, boolean sensitive) 
          Creates a StringFilter that accepts text nodes containing a string.
StringFilter(String pattern, boolean sensitive, Locale locale) 
          Creates a StringFilter that accepts text nodes containing a string.

RegexFilter() 
          Creates a new instance of RegexFilter that accepts string nodes matching the regular expression ".*" using the FIND strategy.
RegexFilter(String pattern) 
          Creates a new instance of RegexFilter that accepts string nodes matching a regular expression using the FIND strategy.
RegexFilter(String pattern, int strategy) 
          Creates a new instance of RegexFilter that accepts string nodes matching a regular expression.

 

3 标签

TagNameFilter()利用标签名过滤 : div ,img , ...

NodeClassFilter()利用标签类别 :LinkTag.class ...

HasAttributeFilter()利用属性 :HasAttributeFilter(“class”“className”)

LinkRegexFilter()用正则表达式匹配链接

TagNameFilter() 
          Creates a new instance of TagNameFilter.
TagNameFilter(String name) 
          Creates a TagNameFilter that accepts tags with the given name.

NodeClassFilter() 
          Creates a NodeClassFilter that accepts Html tags.
NodeClassFilter(Class cls) 
          Creates a NodeClassFilter that accepts tags of the given class.
HasAttributeFilter() 
          Creates a new instance of HasAttributeFilter.
HasAttributeFilter(String attribute) 
          Creates a new instance of HasAttributeFilter that accepts tags with the given attribute.
HasAttributeFilter(String attribute, String value) 
          Creates a new instance of HasAttributeFilter that accepts tags with the given attribute and value.
LinkRegexFilter(String regexPattern) 
          Creates a LinkRegexFilter that accepts LinkTag nodes containing a URL that matches the supplied regex pattern.
LinkRegexFilter(String regexPattern, boolean caseSensitive) 
          Creates a LinkRegexFilter that accepts LinkTag nodes containing a URL that matches the supplied regex pattern.
LinkStringFilter(String pattern) 
          Creates a LinkStringFilter that accepts LinkTag nodes containing a URL that matches the supplied pattern.
LinkStringFilter(String pattern, boolean caseSensitive) 
          Creates a LinkStringFilter that accepts LinkTag nodes containing a URL that matches the supplied pattern.

 

4 层次关系

HasParentFilter() 
          Creates a new instance of HasParentFilter.
HasParentFilter(NodeFilter filter) 
          Creates a new instance of HasParentFilter that accepts nodes with the direct parent acceptable to the filter.
HasParentFilter(NodeFilter filter, boolean recursive) 
          Creates a new instance of HasParentFilter that accepts nodes with a parent acceptable to the filter.

HasChildFilter() 
          Creates a new instance of a HasChildFilter.
HasChildFilter(NodeFilter filter) 
          Creates a new instance of HasChildFilter that accepts nodes with a direct child acceptable to the filter.
HasChildFilter(NodeFilter filter, boolean recursive) 
          Creates a new instance of HasChildFilter that accepts nodes with a child acceptable to the filter.
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值