Download Delve® SOA Fast-Prototyping Toolkit (Beta 1.0)
| Tutorials - How To Get All Elements in XPath, Regardless of Name |
Page 1 of 3 |
Sometimes we want to get all elements in a group, regardless of what they’re named. In XPath, this is accomplished using the “wildcard” symbol, and in this lesson we look at a number of ways that wildcards can be put to use.
XPath lets us select all of the sibling elements in a group by using an asterisk, “*” character as a wildcard symbol where we would normally put a member name.
To see how this works, consider an XML document representing a set of parents and their children.

Suppose we want to obtain a list of all children in the document. Some children are represented using “daughter” elements and some are in “son” elements.” We need a way to obtain all elements sitting beneath “children” elements, regardless of name. This can be accomplished using a wildcard.

|
|
|