The all and any Operators

The all and any operators have very specific behaviors. The all operator examines every node at the specified level and returns the result only if all of the nodes satisfy the stated criteria. The any operator is in many ways the opposite, in that it returns the result if any of the nodes satisfy the given criteria.

Go back to the HTML file and modify the line that selects the nodes to match the following:

var NodeData=DataSource1.selectNodes("//Catalog[$any$
Book/Title='101 Unusual Uses for Hairspray']");

The output will be all five nodes of the <Catalog> file because there's one node where the book title is the one listed.

Go back to the HTML file and modify the line that selects the nodes to match the following: ...

Get Sams Teach Yourself XML in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.