- 浏览: 208559 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
strong8808:
activemq5.8.0 客户端,服务端启动序列图 -
xurichusheng:
第一题,如果使用 not exists 的话,可以改成:SEL ...
SQL笔试题 -
dingjun1:
cuisuqiang 写道如何解决呢?我的是对了也照样缓存增加 ...
事务未正确关闭引起的HIBERNATE SESSION不能正确关闭 -
dingjun1:
aijezdm915 写道lz ,我也是在写项目描述是犯愁,能 ...
如果在简历中描述项目 -
aijezdm915:
lz ,我也是在写项目描述是犯愁,能否给个你的简历demo,我 ...
如果在简历中描述项目
转载:http://www.w3schools.com/XPath/xpath_syntax.asp
暂时没有整理,乱,以后再整理
Selecting Nodes
/
//
XPath uses path expressions to select nodes in an XML document. The node is selected by following a path or steps. The most useful path expressions are listed below:
Expression Description
nodename Selects all child nodes of the named node
/
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes
In the table below we have listed some path expressions and the result of the expressions:
Path Expression Result
bookstore Selects all the child nodes of the bookstore element
/bookstore Selects the root element bookstore
Note: If the path starts with a slash ( / ) it always represents an absolute path to an element!
bookstore/book Selects all book elements that are children of bookstore
//book Selects all book elements no matter where they are in the document
bookstore//book Selects all book elements that are descendant of the bookstore element, no matter where they are under the bookstore element
//@lang Selects all attributes that are named lang
Predicates
Predicates are used to find a specific node or a node that contains a specific value.
Predicates are always embedded in square brackets.
In the table below we have listed some path expressions with predicates and the result of the expressions:
Path Expression Result
/bookstore/book[1] Selects the first book element that is the child of the bookstore element.
Note: IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!!
/bookstore/book[last()] Selects the last book element that is the child of the bookstore element
/bookstore/book[last()-1] Selects the last but one book element that is the child of the bookstore element
/bookstore/book[position()<3] Selects the first two book elements that are children of the bookstore element
//title[@lang] Selects all the title elements that have an attribute named lang
//title[@lang='eng'] Selects all the title elements that have an attribute named lang with a value of 'eng'
/bookstore/book[price>35.00] Selects all the book elements of the bookstore element that have a price element with a value greater than 35.00
/bookstore/book[price>35.00]/title Selects all the title elements of the book elements of the bookstore element that have a price element with a value greater than 35.00
Selecting Unknown Nodes
XPath wildcards can be used to select unknown XML elements.
Wildcard Description
* Matches any element node
@* Matches any attribute node
node() Matches any node of any kind
In the table below we have listed some path expressions and the result of the expressions:
Path Expression Result
/bookstore/* Selects all the child nodes of the bookstore element
//* Selects all elements in the document
//title[@*] Selects all title elements which have any attribute
Selecting Several Paths
By using the | operator in an XPath expression you can select several paths.
In the table below we have listed some path expressions and the result of the expressions:
Path Expression Result
//book/title | //book/price Selects all the title AND price elements of all book elements
//title | //price Selects all the title AND price elements in the document
/bookstore/book/title | //price Selects all the title elements of the book element of the bookstore element AND all the price elements in the document
暂时没有整理,乱,以后再整理
Selecting Nodes
Selects from the root node |
Selects nodes in the document from the current node that match the selection no matter where they are |
XPath uses path expressions to select nodes in an XML document. The node is selected by following a path or steps. The most useful path expressions are listed below:
Expression Description
nodename Selects all child nodes of the named node
/
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes
In the table below we have listed some path expressions and the result of the expressions:
Path Expression Result
bookstore Selects all the child nodes of the bookstore element
/bookstore Selects the root element bookstore
Note: If the path starts with a slash ( / ) it always represents an absolute path to an element!
bookstore/book Selects all book elements that are children of bookstore
//book Selects all book elements no matter where they are in the document
bookstore//book Selects all book elements that are descendant of the bookstore element, no matter where they are under the bookstore element
//@lang Selects all attributes that are named lang
Predicates
Predicates are used to find a specific node or a node that contains a specific value.
Predicates are always embedded in square brackets.
In the table below we have listed some path expressions with predicates and the result of the expressions:
Path Expression Result
/bookstore/book[1] Selects the first book element that is the child of the bookstore element.
Note: IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!!
/bookstore/book[last()] Selects the last book element that is the child of the bookstore element
/bookstore/book[last()-1] Selects the last but one book element that is the child of the bookstore element
/bookstore/book[position()<3] Selects the first two book elements that are children of the bookstore element
//title[@lang] Selects all the title elements that have an attribute named lang
//title[@lang='eng'] Selects all the title elements that have an attribute named lang with a value of 'eng'
/bookstore/book[price>35.00] Selects all the book elements of the bookstore element that have a price element with a value greater than 35.00
/bookstore/book[price>35.00]/title Selects all the title elements of the book elements of the bookstore element that have a price element with a value greater than 35.00
Selecting Unknown Nodes
XPath wildcards can be used to select unknown XML elements.
Wildcard Description
* Matches any element node
@* Matches any attribute node
node() Matches any node of any kind
In the table below we have listed some path expressions and the result of the expressions:
Path Expression Result
/bookstore/* Selects all the child nodes of the bookstore element
//* Selects all elements in the document
//title[@*] Selects all title elements which have any attribute
Selecting Several Paths
By using the | operator in an XPath expression you can select several paths.
In the table below we have listed some path expressions and the result of the expressions:
Path Expression Result
//book/title | //book/price Selects all the title AND price elements of all book elements
//title | //price Selects all the title AND price elements in the document
/bookstore/book/title | //price Selects all the title elements of the book element of the bookstore element AND all the price elements in the document
发表评论
-
solr/home 设置
2013-04-21 00:44 1210solr/home是solr实例化core核的依据和入口,是必 ... -
CronTrigger Tutorial
2011-02-24 18:58 872转载地址:http://www.quartz-schedule ... -
事务未正确关闭引起的HIBERNATE SESSION不能正确关闭
2010-10-30 13:46 1625问题现象: 第一 ... -
hibernate 四种抓取策略
2010-10-24 10:42 895转载:http://www.cnblogs.com ... -
cas分析
2010-05-10 13:20 1953Central Authentication Service ... -
FCKeditor2.6.5及后续版本 for PHP配置及中文上传乱码解决!
2009-12-10 13:37 1376对于Fckeditor上传中文名文件时显示乱码的问题,现公布方 ... -
jstl标签中循环map
2009-10-12 20:58 2553<% Map map = new HashMap(); ... -
log4j输出多个自定义日志文件(分离日志)
2009-06-24 11:30 2567转载: http://wangjc-opal.iteye.co ... -
错误: 必须限制口令文件读取访问
2008-10-10 17:06 3064转载:http://hi.baidu.com/lifecodi ... -
spring AOP使用结总结
2008-09-12 14:23 1073AOP使用结总结 最近需要 ... -
log4j手动加载配置文件
2008-09-10 15:26 3138PropertyConfigurator.configur ... -
spring集成hibernate使用缓存简单实例
2008-07-08 18:20 2305这部分为转载:http://www ... -
lucene应用入门1
2008-07-06 16:49 2113简单的建立索引和索引 ... -
多对多查询的条件设置和删除问题
2008-07-03 14:50 1469select 父 from 父类 父 left join 父. ... -
DOM4J学习笔记
2008-07-01 15:07 3673DOM4J简单介绍 基本使用 读取XML文档 Import o ... -
延迟初始化错误(转载)
2008-06-12 17:52 982转载地址:http://lz726.ite ... -
UUID [转帖]
2008-05-20 15:25 892/***********本人原创,欢迎转载,转载请保留本人信息 ... -
一段简单的发送邮件代码
2008-04-28 15:57 1013package send; import java. ... -
重新学习 Hibernate fetch lazy cascade inverse[转载]
2008-04-21 11:55 1207转载:http://www.blogjava.ne ... -
HIBERNATE2 CLOB字段延迟加载办法[转载]
2008-04-18 13:49 3060[转载]http://callan.iteye.com/blo ...
相关推荐
主要介绍了Python3 xml.etree.ElementTree支持的XPath语法详解,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
C#对xml中关于使用xpath语法的介绍
XPath语法详细介绍 XPath语法详细介绍 XPath语法详细介绍 XPath语法详细介绍 XPath语法详细介绍
xpath语法
xpath语法与函数
爬虫xpath 应用于浏览器的一个插件,便于帮助书写xpath路径
来源:MSDN 包含XPath语法、运算符、示例。
XPath语法简要说明1
对XPath语法进行了详细的讲解。XPath可以快速定位到Xml中的节点或者属性。XPath语法很简单,但是强大够用,它也是使用xslt的基础知识。开发人员必备
astpath:一个命令行工具用于使用XPath语法查询Python ASTs
主要给大家介绍了关于Python爬虫基础之XPath语法与lxml库用法的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
一个用webservice和jquery 编写的XPATH语法测试的网页文件
介绍XSL语法中Xpath的使用方法
Xpath生成器,自动生成可用的Xpath
NULL 博文链接:https://z-one.iteye.com/blog/1172949
二、xpath helper插件三、xpath helper安装使用方法四、XPath语法4.1 节点语法4.2 节点实例4.3 谓语(Predicates)4.4 选取未知节点4.5 选取若干路径五、XPath 轴5.1 轴常用语法5.2 位置路径表达式5.3 步(step)的...
整理JsoupXpath( https://github.com/zhegexiaohuozi/JsoupXpath)是一款纯Java开发的使用xpath解析提取html内容的解析器,xpath语法分析与执行...JsoupXpath的实现逻辑清晰,扩展方便, 支持几乎全部常用的xpath语法。
2、理解XPath的类型系统和序列类型等相关概念,掌握XPath表达式语法和执行语义,能够熟练地、灵活地运用各种关系轴、判定谓词和XPath基本函数编写查询表达式。 3、掌握XSLT文档中基本语法单元的使用,比如模板的定义...