473,486 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Retrieving items from XML file


Hi,

I am new to XPath and I am stuck with an expression. I would like to select all servers which the user subscribed to. Here is my XML:
<forums>
<forum>
<name>AAA</name>
<subscribed>1</subscribed>
</forum>
<forum>
<name>BBB</name>
<subscribed>0</subscribed>
</forum>
.....
.....
I would like to retrieve "AAA" since it is a server with "subscribed=1".

I tried various syntaxes, unsuccessfully. This is the last one:

....... ("servers:server[servers:name='" + server + "']/servers:forums/servers:name[subscribed='1']", m_ServersDoc);

Thanks
Mike
Nov 16 '05 #1
1 879
Hi Mike,

I would recommed that you change your XML to:
<forums><forum name = "AAA" subscribed = "1" /><forum name = "BBB" subscribed = "0" /><forum name = "CCC" subscribed = "1" /><forum name = "DDD" subscribed = "1" /></forums

then you can select all the forums with subscribed= '1' with this:
"//forum[@subscribed='1']

Hope it helps.

Regards
Peter
Nov 16 '05 #2

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

Similar topics

6
9620
by: Dave Hopper | last post by:
Hi I am using the following SQL to retrieve a value in a list box using a unique ID held in the list box call cntID. The list box is used on an order form to list appointments that have been...
13
3940
by: RHPT | last post by:
I am wanting to capture the XML posted by an InfoPath form with .NET, but I cannot figure out how to capture the XML stream sent back by the InfoPath form. With Classic ASP, I could just create an...
5
7701
by: jan axelson | last post by:
My application is using RegisterDeviceNotification() to detect attachment and removal of a USB HID-class device. The form is receiving WM_DEVICECHANGE messages with wParam set to...
1
1190
by: Roshawn | last post by:
Hi, How do you retrieve only a subset of items from an ArrayList using a For...Next loop? For instance, say I want to work only with 30 ArrayList items at a time. After processing the 30...
0
1873
by: yeltsin27 | last post by:
I need some advice on handling dynamically added controls in a GridView. My app takes an uploaded CSV file containing addresses, converts it to a DataTable, databinds the DataTable to a...
0
3069
by: Klaki | last post by:
I'm trying to create an instance of Outlook using VB.net and every time I run the site, I get the following error: Retrieving the COM class factory for component with CLSID...
0
1173
by: riteshraha | last post by:
I cant retrieve selected item from checkboxlist in asp.net project. when i submit multiple item from checkboxlist it works fine. but when i am trying to edit this items then checkboxlist does not...
1
2080
by: mary mathews | last post by:
Hi, I'm getting an exception while tried to retrive an outlook contact using asp.net in a console application. The exception is as follows: An unhandled exception of type...
3
2154
by: Bruno Vignola | last post by:
Good Morning all, I need to interoperate with the Calendar of MS Outlook 2003 (inserting, retrieving, listing events, etc. etc.) from an ASP.NET application; I first developed a simple windows...
2
2809
by: phpnewbie26 | last post by:
I currently have two drop down menus where the second one is populated from the first one. My second drop down menu should be able to do multiple selection. I have searched online and found out how...
0
7100
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
7126
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,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7330
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
5434
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
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
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.