XPath

XPath 表示的是XML 路径的语言。它使用的一个非XML语法提供一种灵活地定位XML文档的不同部分的方法。 同时也可以检测文档中某个节点是否与某个模式(pattern)匹配。

XPath 主要被用于 XSLT,  也可用于定位文档元素,像类XML语言文档(如,HTML and XUL ) 通过DOM定位元素一样。替代 document.getElementById 方法、 element.childNodes 属性和其他DOM核心特性。

XPath 使用路径标识符通过层级结构来导航XML文档。它使用非XML语法,以致于它可以被用在URIs和XML属性值上。

Note: XPath 的浏览器支持差别很大; 在火狐浏览器中支持地相当不错 (尽管没有计划进一步提高支持), 而其他浏览器则较小程度地实现了它. 如果你需要一个兼容主流浏览器的XPath, 你可以需要考虑下 js-xpathwicked-good-xpath.

Documentation

介绍在JavaScript使用XPath
描述XPath的一个非XSLT的使用。
XPath:Axes
List and definition of the axes defined in the XPath specification. Axes are used to describe the relationships between nodes.
XPath:Functions
List and description of the core XPath functions and XSLT-specific additions to XPath.
Transforming XML with XSLT
XSLT uses XPath to address code segments in a XML document that it wishes to transform.
XPath snippets
JavaScript utility functions to use in your own code, based on  DOM Level 3 XPath APIs.
What is XSLT?
This extensive introduction to XSLT and XPath assumes no prior knowledge of the technologies, and guides the reader through background, context, structure, concepts and introductory terminology.
JXON
JXON (lossless JavaScript XML Object Notation) is a generic name by which is defined the representation of JavaScript Objects using XML. There are some cases in which the whole content of an XML document must be read from the JavaScript interpreter (like for web-apps languages or settings XML documents, for example). In these cases JXON could represent the most practical way and a valid alternative to XPath.

View All...

Tools

XPather
Feature rich XPath generator, editor, inspector and simple extraction tool (FireFox Add-On).
FireXPath
XPath panel that integrates tightly into FireBug, providing an editor and inspector (FireFox Add-On).
XPath Checker
An interactive editor for XPath expressions (FireFox Add-On).
SketchPath
A Graphical XPath Builder/Debugger(.NET).

 

文档标签和贡献者