473,396 Members | 2,050 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,396 software developers and data experts.

Help on Filtering XML nodes ???

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 is particular usefull to be bind to a treeview
as it handle nodes. So I have try to save my dataset content into a xml file.
The content of that file is as follow :

- <NewDataSet>
- <REC_INFO>
<FILE_NAME>REC00001.CSV</FILE_NAME>
<RECIPE_CLASS>Pipe</RECIPE_CLASS>
<RECIPE_NAME>25 x 2.5 mm</RECIPE_NAME>
<LINE_NAME>LP602</LINE_NAME>
<GROUPE_NAME>LP602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>
- <REC_INFO>
<FILE_NAME>REC00002.CSV</FILE_NAME>
<RECIPE_CLASS>Profile</RECIPE_CLASS>
<RECIPE_NAME>Coling</RECIPE_NAME>
<LINE_NAME>LP602</LINE_NAME>
<GROUPE_NAME>LP602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>

Then I have founc a sample function that bind xmlnodes to treeview node but
then in my case it displays all of them. I am only interesting to display ina
treeview the XML node named RECIPE_CLASS

I have seen that for filtering nodes we need to us Xpath but how to define
my filter then
How can I do that ?

Thanks for your help
regards
serge
Jul 21 '05 #1
3 2149
The XPath expression is:
/REC_INFO/RECIPE_CLASS

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:C5**********************************@microsof t.com...
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 is particular usefull to be bind to a treeview
as it handle nodes. So I have try to save my dataset content into a xml
file.
The content of that file is as follow :

- <NewDataSet>
- <REC_INFO>
<FILE_NAME>REC00001.CSV</FILE_NAME>
<RECIPE_CLASS>Pipe</RECIPE_CLASS>
<RECIPE_NAME>25 x 2.5 mm</RECIPE_NAME>
<LINE_NAME>LP602</LINE_NAME>
<GROUPE_NAME>LP602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>
- <REC_INFO>
<FILE_NAME>REC00002.CSV</FILE_NAME>
<RECIPE_CLASS>Profile</RECIPE_CLASS>
<RECIPE_NAME>Coling</RECIPE_NAME>
<LINE_NAME>LP602</LINE_NAME>
<GROUPE_NAME>LP602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>

Then I have founc a sample function that bind xmlnodes to treeview node
but
then in my case it displays all of them. I am only interesting to display
ina
treeview the XML node named RECIPE_CLASS

I have seen that for filtering nodes we need to us Xpath but how to define
my filter then
How can I do that ?

Thanks for your help
regards
serge

Jul 21 '05 #2
Thnaks for the info , I will give a try..

by the way if I apply my XPath string as you said /RECE_INFO/RECIPE_CLASSE
I should retrieve only those node right?

Ok then I add my first node in my treeview collection. Then things that
might happen is that I could have more that one RECIPE_CLASS node value. , so
I can I verify if my node is already existing in treenode collection in order
to ad it or not ?

I have try to use the Contains(myNode) function but it always return false
even if the node ahas really be added.

Any suggestion ?

thnaks for your help
serge

"Sean Hederman" wrote:
The XPath expression is:
/REC_INFO/RECIPE_CLASS

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:C5**********************************@microsof t.com...
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 is particular usefull to be bind to a treeview
as it handle nodes. So I have try to save my dataset content into a xml
file.
The content of that file is as follow :

- <NewDataSet>
- <REC_INFO>
<FILE_NAME>REC00001.CSV</FILE_NAME>
<RECIPE_CLASS>Pipe</RECIPE_CLASS>
<RECIPE_NAME>25 x 2.5 mm</RECIPE_NAME>
<LINE_NAME>LP602</LINE_NAME>
<GROUPE_NAME>LP602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>
- <REC_INFO>
<FILE_NAME>REC00002.CSV</FILE_NAME>
<RECIPE_CLASS>Profile</RECIPE_CLASS>
<RECIPE_NAME>Coling</RECIPE_NAME>
<LINE_NAME>LP602</LINE_NAME>
<GROUPE_NAME>LP602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>

Then I have founc a sample function that bind xmlnodes to treeview node
but
then in my case it displays all of them. I am only interesting to display
ina
treeview the XML node named RECIPE_CLASS

I have seen that for filtering nodes we need to us Xpath but how to define
my filter then
How can I do that ?

Thanks for your help
regards
serge


Jul 21 '05 #3
"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:C0**********************************@microsof t.com...
Thnaks for the info , I will give a try..

by the way if I apply my XPath string as you said /RECE_INFO/RECIPE_CLASSE
I should retrieve only those node right?
Yes.
Ok then I add my first node in my treeview collection. Then things that
might happen is that I could have more that one RECIPE_CLASS node value. ,
so
I can I verify if my node is already existing in treenode collection in
order
to ad it or not ?

I have try to use the Contains(myNode) function but it always return false
even if the node ahas really be added.
What's probably happenning is like the following:
TreeNode firstNode = new TreeNode("Hello");
myTree.Nodes.Add(firstNode);
TreeNode secondNode = new TreeNode("Hello");
bool exists = myTree.Nodes.Contains(secondNode));

The variable exists will always be false, since we are dealing with two
different TreeNode objects. They may have the same text, but the objects are
not the same. You could just iterate the tree view to see if any nodes at
that level have the specified text. If it's a large number of nodes, some
kind of hashed collection would probably be ideal. Alternatively

//RECE_INFO/RECIPE_CLASSE[not(.=preceding::RECIPE_CLASSE)]

But this would imply that the XML is sorted by RECIPE_CLASSE. You can do
this by using XPathExpression and adding RECIPE_CLASSE to AddSort.
Any suggestion ?

thnaks for your help
serge

"Sean Hederman" wrote:
The XPath expression is:
/REC_INFO/RECIPE_CLASS

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:C5**********************************@microsof t.com...
> 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 is particular usefull to be bind to a
> treeview
> as it handle nodes. So I have try to save my dataset content into a xml
> file.
> The content of that file is as follow :
>
> - <NewDataSet>
> - <REC_INFO>
> <FILE_NAME>REC00001.CSV</FILE_NAME>
> <RECIPE_CLASS>Pipe</RECIPE_CLASS>
> <RECIPE_NAME>25 x 2.5 mm</RECIPE_NAME>
> <LINE_NAME>LP602</LINE_NAME>
> <GROUPE_NAME>LP602</GROUPE_NAME>
> <MODIFIED>02/11/2004 15:15:04</MODIFIED>
> </REC_INFO>
> - <REC_INFO>
> <FILE_NAME>REC00002.CSV</FILE_NAME>
> <RECIPE_CLASS>Profile</RECIPE_CLASS>
> <RECIPE_NAME>Coling</RECIPE_NAME>
> <LINE_NAME>LP602</LINE_NAME>
> <GROUPE_NAME>LP602</GROUPE_NAME>
> <MODIFIED>02/11/2004 15:15:04</MODIFIED>
> </REC_INFO>
>
> Then I have founc a sample function that bind xmlnodes to treeview node
> but
> then in my case it displays all of them. I am only interesting to
> display
> ina
> treeview the XML node named RECIPE_CLASS
>
> I have seen that for filtering nodes we need to us Xpath but how to
> define
> my filter then
> How can I do that ?
>
> Thanks for your help
> regards
> serge


Jul 21 '05 #4

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

Similar topics

2
by: csx | last post by:
Hi all, I'm trying to count the number of leafnodes for a particular node. What im trying to do is make a function, that taking the tree structure: key row desc parent 1 1 A ...
4
by: Derek | last post by:
Hi, I've built a rather large CGI that dumps a lot of data and a fairly complex javascript app out to the client's browser. Granted this may be poor style according to someone web design...
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...
2
by: Alan Searle | last post by:
I would like to use an XSL/HTML template to sort XML data dynamically on the client side. As it is, I found a tutorial showing how to do this on the following site ... ...
1
by: Sisnaz | last post by:
I'm sending a message from VB.net (2003) to a C++ app via TCP sockets of values 1 to 328. The message is a WORD value where I have to manage both bytes for the WORD. I'm sending and receiving data...
1
by: sp | last post by:
<files> <file id="1" type="txt"> <indicies index="A"> <keyword>key1</keyword> </indices> <indicies index="B"> <keyword>key2</keyword> </indices> <indicies index="A"> <keyword>key3</keyword>
2
by: JUAN ERNESTO FLORES BELTRAN | last post by:
Hi you all, I am developping a python application which connects to a database (postresql) and displays the query results on a treeview. In adittion to displaying the info i do need to implement...
9
by: =?Utf-8?B?YWJjZA==?= | last post by:
I have a list of items. Some of the items are another list and that list item could be another list. Now I want to filter the main list by the inner list item value based on some criteria... My...
0
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I've created a treeview control that gives a folder browser view of a given computer. The treeview is populated using the following methods: Protected Sub treeDst_Init(ByVal sender...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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,...
0
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
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
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,...

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.