XPath

XPath is another XML-related technology that has been standardized by the
W3C. XPath is a language used to query an XML document for a list of nodes
matching a given criteria.An XPath expression can specify both location and a
pattern to match.You can also apply Boolean operators, string functions, and arithmetic
operators to XPath expressions to build extremely complex queries against
an XML document. XPath also provides functions to do numeric evaluations such as summations and rounding.The following are some of the capabilities of the XPath
language:
■ Find all children of the current node
■ Find all ancestor elements of the current context node with a
specific tag
■ Find the last child element of the current node with a specific tag.
■ Find the nth child element of the current context node with a
given attribute.
■ Find the first child element with a tag of or .
■ Get all child nodes that do not have an element with a given attribute.
■ Get the sum of all child nodes with a numeric element.
■ Get the count of all child nodes.
The preceding list just scratches the surface of the capabilities available using
XPath. Again, the .NET framework provides support for XPath queries against
XML DOM documents and read-only XPath documents.We will be working
with XPath throughout the book by using its respective System.XML classes.

0 comments: