Output from queryNodes Example
After you build and run the application, you should see the following output displayed in the application's console.
Notice that the output below confirms that the selectSingleNode
method picks out only the first node from the node set as specified by the XPath expression (//stock[1]/*
). The selectNodes
method returns the entire set of nodes specified by this XPath expression.
Next, we'll demonstrate how to validate XML.
To verify the queryNodes example
- Verify that you get the following output.
Output
Result from selectSingleNode:
Node, <name>:
<name>new</name>
Results from selectNodes:
Node (0), <name>:
<name>new</name>
Node (1), <symbol>:
<symbol>zzzz</symbol>
Node (2), <price>:
<price xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="number">20.313</price>