473,785 Members | 2,987 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 2197
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
2849
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
1421
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
9645
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
9480
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,...
0
10327
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
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...
0
8973
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.