473,770 Members | 6,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>REC0 0001.CSV</FILE_NAME>
<RECIPE_CLASS>P ipe</RECIPE_CLASS>
<RECIPE_NAME> 25 x 2.5 mm</RECIPE_NAME>
<LINE_NAME>LP60 2</LINE_NAME>
<GROUPE_NAME>LP 602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>
- <REC_INFO>
<FILE_NAME>REC0 0002.CSV</FILE_NAME>
<RECIPE_CLASS>P rofile</RECIPE_CLASS>
<RECIPE_NAME>Co ling</RECIPE_NAME>
<LINE_NAME>LP60 2</LINE_NAME>
<GROUPE_NAME>LP 602</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 2194
The XPath expression is:
/REC_INFO/RECIPE_CLASS

"serge calderara" <se************ @discussions.mi crosoft.com> wrote in
message news:C5******** *************** ***********@mic rosoft.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>REC0 0001.CSV</FILE_NAME>
<RECIPE_CLASS>P ipe</RECIPE_CLASS>
<RECIPE_NAME> 25 x 2.5 mm</RECIPE_NAME>
<LINE_NAME>LP60 2</LINE_NAME>
<GROUPE_NAME>LP 602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>
- <REC_INFO>
<FILE_NAME>REC0 0002.CSV</FILE_NAME>
<RECIPE_CLASS>P rofile</RECIPE_CLASS>
<RECIPE_NAME>Co ling</RECIPE_NAME>
<LINE_NAME>LP60 2</LINE_NAME>
<GROUPE_NAME>LP 602</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.mi crosoft.com> wrote in
message news:C5******** *************** ***********@mic rosoft.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>REC0 0001.CSV</FILE_NAME>
<RECIPE_CLASS>P ipe</RECIPE_CLASS>
<RECIPE_NAME> 25 x 2.5 mm</RECIPE_NAME>
<LINE_NAME>LP60 2</LINE_NAME>
<GROUPE_NAME>LP 602</GROUPE_NAME>
<MODIFIED>02/11/2004 15:15:04</MODIFIED>
</REC_INFO>
- <REC_INFO>
<FILE_NAME>REC0 0002.CSV</FILE_NAME>
<RECIPE_CLASS>P rofile</RECIPE_CLASS>
<RECIPE_NAME>Co ling</RECIPE_NAME>
<LINE_NAME>LP60 2</LINE_NAME>
<GROUPE_NAME>LP 602</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.mi crosoft.com> wrote in
message news:C0******** *************** ***********@mic rosoft.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.Ad d(firstNode);
TreeNode secondNode = new TreeNode("Hello ");
bool exists = myTree.Nodes.Co ntains(secondNo de));

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.mi crosoft.com> wrote in
message news:C5******** *************** ***********@mic rosoft.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>REC0 0001.CSV</FILE_NAME>
> <RECIPE_CLASS>P ipe</RECIPE_CLASS>
> <RECIPE_NAME> 25 x 2.5 mm</RECIPE_NAME>
> <LINE_NAME>LP60 2</LINE_NAME>
> <GROUPE_NAME>LP 602</GROUPE_NAME>
> <MODIFIED>02/11/2004 15:15:04</MODIFIED>
> </REC_INFO>
> - <REC_INFO>
> <FILE_NAME>REC0 0002.CSV</FILE_NAME>
> <RECIPE_CLASS>P rofile</RECIPE_CLASS>
> <RECIPE_NAME>Co ling</RECIPE_NAME>
> <LINE_NAME>LP60 2</LINE_NAME>
> <GROUPE_NAME>LP 602</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
2848
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 0 2 2 B 1 3 2 C 1 4 3 D 3
4
4813
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 philosophy but that is the way things need to work for now here. The problem I'm having is that it appears that the browsers (IE, mozilla and netscape) are sometimes getting confused about wether the javascript code is running. By this I mean when I...
3
292
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 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>
2
6178
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 ... http://www.bayes.co.uk/xml/portal.aspx?page=/xml/tutorial/index.xml&subpage=/xml/tutorial/filtering/filter.xml I experimented with the examples and found that they would run fine on a local PC (without installing a web-server). That is just what I need!
1
1771
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 from the C++ app with no problem between the values of 1 to 127 and 256 to 328, but the application receives garabage between 128 and 255. My current test syntax is as follows: Dim nodeid As Integer = CType(txtMessage.Text, Integer) Dim...
1
1203
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
3095
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 filtering facility for all the columns of the treestore/liststore model in order to allow the user an easy search method to find the desired information. The treestore is created with information related to cars, the columns are:
9
6424
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 fileter criteria is, A and B and C and D and E then get the filtered item...where A, B , C ,D, E are passed from the frong end. How can I efficiently filter the main list. Any generic efficient logic so that I can make it more generic code...
0
1420
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 As Object, ByVal e As System.EventArgs) Handles treeDst.Init Dim dirInfo As New DirectoryInfo("C:\") dstDir.Text = dirInfo.FullName
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10001
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
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 we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.