| |
XPath is a language for selecting XML nodes. It was originally part of the
XSLT spec, but was split out because the W3C realized XPath was useful
by itself. XPath is used to
- Find XML nodes
- Iterate over matching XML nodes
- Spider web pages
- Extract values from XML
- Drive the XSLT match patterns
Although the main use of XPath is in conjunction with XSLT, Resin
provides an API in com.caucho.xpath to extract values from XML.
The core of the XPath language is hierarchical path, like a URL.
a | matches any element a
|
* | matches any element, but not attributes or text nodes
|
@b | matches any attribute b
|
text() | matches any text node
|
a/b | matches an element b only if it's a child of an a
|
/html/body | matches body only if it's the child of html
and html is the top element.
|
a[b] | matches an element a only if it has a child element b
|
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|