473,385 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Select nodes by filter

Hello!

I've got following XML structure

<ROOT>
<DATASET>
<ID>1</ID>
<VALUE>Test1</VALUE>
</DATASET>
<DATASET>
<ID>2</ID>
<VALUE>Test2</VALUE>
</DATASET>
<DATASET>
<ID>3</ID>
<VALUE>Test3</VALUE>
</DATASET>
</ROOT>

I want to select all dataset nodes having a certain id value.

SelectNodes will give me a collection of ALL dataset nodes.

I need something like SelectNodesByFilter("ROOT/DATASET", "ID < 3")

Does someone know a way how to solve that problem optimally?

Regards,
Norbert

Sep 1 '06 #1
2 2805
"Norbert Pürringer" <th*******@graffiti.netwrote in message
news:57***************************@news.chello.at. ..
Hello!

I've got following XML structure

<ROOT>
<DATASET>
<ID>1</ID>
<VALUE>Test1</VALUE>
</DATASET>
<DATASET>
<ID>2</ID>
<VALUE>Test2</VALUE>
</DATASET>
<DATASET>
<ID>3</ID>
<VALUE>Test3</VALUE>
</DATASET>
</ROOT>

I want to select all dataset nodes having a certain id value.

SelectNodes will give me a collection of ALL dataset nodes.

I need something like SelectNodesByFilter("ROOT/DATASET", "ID < 3")
SelectNodes("/ROOT/DATASET[number(ID) gt 1]") will return the set of nodes
whose ID value is greater than 1.

John
Sep 1 '06 #2


Norbert Pürringer wrote:

I need something like SelectNodesByFilter("ROOT/DATASET", "ID < 3")

xmlDocument.SelectNodes("ROOT/DATASET[ID < 3]")
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Sep 1 '06 #3

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

Similar topics

3
by: Michael Reiche | last post by:
Question on XSL expression Got this XML: <Body> <Page> <Line no="9" detail="true"> <onefield>onefieldstext</onefield> <twofield>twofieldstext</twofield> </Line>
3
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format...
6
by: Nikhil Patel | last post by:
Hi all, Following is a portion of an XML document. I need to remove all nodes that belong to ns0 without deleting their child nodes. So in the following example , I want to delete "ns0:Proposal"...
2
by: Greg | last post by:
Hi. I have a rather large xml document (object) that can have one or more nodes with a certain attribute throughout (at ANY depth, not at the same level necessarily). I need to find this...
1
by: Robin Tucker | last post by:
No matter what I try, I cannot get my tree nodes (in my TreeView) to display in bold. I have a "filter" system, whereby I should highlight items in the tree that have passed the filter. To do...
1
by: Andy | last post by:
Hi, Does anyone know why when I hardcode a literal to filter a subset of nodes by a particular attribute value, my template processes the correct subset. But, when I use a variable that is set...
4
by: =?Utf-8?B?Q2Fpcm4=?= | last post by:
I am new to Xpath but wish to parse an XML document for nodes which contain a child node with a particuale value. Please does anybody have any clues as to why I never get any returns in the root...
4
by: reflex | last post by:
I have to get every node within range or selection? Is it possible? Sry for my engrish :] Ref
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.