473,473 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MSXML6 C++ VS2005: parsing "set" of nodes (& child nodes)??

Hi,
I've looked at a number of examples in the MSXML6 help, but haven't been
able to find exactly what I'm looking for.

I have the following loaded into a "IXMLDOMDocument2" object.

I have a CString sString that I would like to check to see if it matches one
of the "Descriptions" below. If it does match, I want to be able to extract
the corresponding "Amount" field to use it elsewhere in the program.

<InquiryResponse>
<Balances>
<Balance>
<Amount>246326.04</Amount>
<Description>Available Balance</Description>
</Balance>
<Balance>
<Amount>246326.04</Amount>
<Description>Current Balance</Description>
</Balance>
</Balances>
</InquiryResponse>

I've looked at the "selectSingleNode", "get_nodeName", "get_xml",
"get_text", and "selectNodes" functions as well as the "IXMLDOMNodeList"
object.

I started hacking something together like:
IXMLDOMDocument2 *pXMLDom=NULL;
bstr2 = SysAllocString(L"//Balance");
hr = pXMLDom->selectNodes(bstr2, &pNodeList);

long max = 0;
hr = pNodeList->get_length(&max);

IXMLDOMNode *pNode2=NULL;
for (long idx = 0; idx < max; idx++)
{
pNodeList->get_item(idx, &pNode2);

}

It all seems rather ackward & clunky to get the info out of the DOM object.
Maybe that's the way MSXML goes.

Can someone point me to a good example (MSDN or other) that would do what
I'm looking to accomplish?

Thanks. Jeff

Mar 21 '07 #1
1 2493
j.a. harriman wrote:
I have a CString sString that I would like to check to see if it matches one
of the "Descriptions" below. If it does match, I want to be able to extract
the corresponding "Amount" field to use it elsewhere in the program.

<InquiryResponse>
<Balances>
<Balance>
<Amount>246326.04</Amount>
<Description>Available Balance</Description>
</Balance>
<Balance>
<Amount>246326.04</Amount>
<Description>Current Balance</Description>
</Balance>
</Balances>
</InquiryResponse>
Use selectSingleNode with the XPath expression
/InquiryResponse/Balances/Balance[Description = 'Current Balance']/Amount
Then check whether the result is not null and if so access its text
property.
Can't help with the C++ doing that but the use of MSXML should be clear
I hope.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 22 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Anthony Liu | last post by:
I want to use the set function like mylist = myset = set (mylist) But I don't know what to import, I tried sys, sets, they don't work. What's the easy way to find out the module that...
3
by: Skip Montanaro | last post by:
I use sets a lot in my Python 2.3 code at work and have been using this hideous import to make the future move to 2.4's set type transparent: try: x = set except NameError: from sets import...
12
by: Me | last post by:
Hi, I would like learn from people with experience in C++, which of the following styles of way to construct "get/set" member functions would be the best in terms of usability, speed, et cetera. ...
7
by: William Payne | last post by:
Hello, I have a variable of type unsigned long. It has a number of bits set (with set I mean they equal one). I need to determine those bits and their position and create new numbers from them. For...
9
by: Anders Borum | last post by:
Hello! I have a class that needs to validate the input value, when a programmer changes a specific property on a class. The input should only accept the following pattern {1,n} (alpha-numeric...
0
by: Bobby Owens | last post by:
Hi, I'm current having a problem with the treeview control and multi threading. The treeview is on a form. A request is then sent to a server using IP for the data. The data arrives in an event...
1
by: Gregor Horvath | last post by:
Hi, I searched the web and docs but cannot figure out whats wrong with this code: #!/usr/bin/python import Tkinter as Tk class testtk(Tk.Frame):
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
1
by: mahdialkhatib | last post by:
Hello everybody, I'm wondering about these accessors and what the benefit that I would get from them i understood what "set function" is for, but i didn't get it with the "get function ". ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.