473,226 Members | 1,519 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,226 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 2139
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.