zoukankan      html  css  js  c++  java
  • HtmlAgilityPack 使用

    或、无属性、属性个数、属性值:

    var preceding_siblings = node.SelectNodes("preceding-sibling::input| preceding-sibling::button[count(@role)>0] | preceding-sibling::div[not(@*)]"); 

    var ancestors = node.SelectNodes("ancestor::div | ancestor:div[@level='primary'] | ancestor::div/ul");

    以全小写查找:

    var content_venue_nodes = this.GetNodes("//div//text()[contains(translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'hello world')]");

    ......

    轴名称

    结果

    ancestor

    选取当前节点的所有先辈(父、祖父等)

    ancestor-or-self

    选取当前节点的所有先辈(父、祖父等)以及当前节点本身

    attribute

    选取当前节点的所有属性

    child

    选取当前节点的所有子元素。

    descendant

    选取当前节点的所有后代元素(子、孙等)。

    descendant-or-self

    选取当前节点的所有后代元素(子、孙等)以及当前节点本身。

    following

    选取文档中当前节点的结束标签之后的所有节点。

    namespace

    选取当前节点的所有命名空间节点

    parent

    选取当前节点的父节点。

    preceding

    直到所有这个节点的父辈节点,顺序选择每个父辈节点前的所有同级节点

    preceding-sibling

    选取当前节点之前的所有同级节点。

    self

    选取当前节点。

  • 相关阅读:
    CentOS上svn checkout时报错SSL handshake failed: SSL error: Key usage violation in certificate has been det
    SnmpTools配置
    Django下载文件
    Cacti的使用
    RRDtool 安装和使用
    SNMP 安装及使用
    Openstack CentOS6.5 ALL IN ONE 安装
    mysqladmin -u root password
    VS2013打包程序步骤
    python中使用rabbitmq消息中间件
  • 原文地址:https://www.cnblogs.com/yipeng-yu/p/7278299.html
Copyright © 2011-2022 走看看