Output
After you build and run the application, you should see the following output displayed in the application's console.
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>
Notice that the output above 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.