XPath学习笔记 XPath数据模型

XPath数据模型

在XPath的视角中,elements, attributes, text, comments, processing instructions 甚至namespaces 都作为树结构中的互相关联的节点来表示的。某些节点如Elements,可以有子节点,有些则不可能,如attributes,根据XML规范是不能有子的。根节点则是终极的父节点。

每个节点通过不同的方式对XPath公开其属性:

  • 一个名字.某些节点如根节点,备注和文本节点的名字永远是空串"", Elements和attributes具有扩充的名字: local name 加上 namespace URI. Processing instructions 使用不受namespace处理影响的"目标"作为名字. namespace 节点则使用前缀作为名字.
  • 一个字符串值.XML源中的文本节点包含文本字符
  • A string value. Text nodes contain the text characters from the source XML, with line endings normalized to #xA as required by the XML specification. Text nodes will always contain as much text as possible, and, thus, no two consecutive children will ever both be text nodes and the location of CDATA sections is not preserved. Comment nodes contain the full text of the comment (minus the <!-- and --> delimiters). Attributes contain the attribute value, and processing instructions contain the text after the initial target and whitespace, and up to and not including the terminating ?>. Namespace nodes contain a URI (or the empty string) as a name. The root node and element nodes compute their string value by recursively concatenating the string values of all descendant nodes.

  • Children. In theory, you can ask about children of any node, but only the root node and element nodes will actually have children.

  • A position relative to all other nodes. The overall ordering is called the document order.


唉..累了,还是直接看英文好了.

 



转载于:https://www.cnblogs.com/xiaotaoliang/archive/2007/04/10/706473.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值