MSXML provides two DOM methods that allow you to query a node or a set of nodes in an XML DOM object: SelectNodes
and SelectSingleNode
. You specify the node or nodes of interest in an XPath expression, which is taken as the input to these methods.
In this C/C++ demonstration, we assume that you have some understanding of XPath expressions.
This project uses the following files.
Component | Description |
---|---|
Source: queryNodeSmart.cpp | Selects both a single node and a node-set from a DOM object. |
Resource: stocks.xml | An XML data file. |
Output | When you build and run the queryNodesSmart project, you should get this output in a console window. |
Create the queryNodesSmart project in Visual C++
Next, we'll add the source code for the queryNodesSmart project.
XPath Developer's Guide | XPath Reference