Accessing the Contents of a Node Using the value() Method

There are several library functions or methods that can be used to construct queries. You've already used one of these, the value() method. It was used to extract the value assigned to the attributes. While attributes are certainly important, the significant data is most often placed inside the tags. The value() method can also be used to extract this data, and that's the subject of the next example.

Go back to the HTML file and modify the line that selects the nodes so that it matches the following:

var NodeData=DataSource1.selectNodes("Catalog/Book/
Author[Name!value()='Charles Ashbacher']");

As expected, the only information that will appear in the output is the <Author> data for ...

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.