473,387 Members | 1,724 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,387 software developers and data experts.

Help Nodes Contains function not working ???

Dear all,

I am populating a treeview control with an XML file.
I need to skip duplicate node entry from XML file in treeview if exit

For that I ma using the following line of code :

If NodeCollection.Contains(node) Then Return True

That function always return false.
If I go through nodeCollection object and check if my Node object exist I
can saee it already in the collection.

Why the Contains return always false ?
Waht is the criteria that identify an existing node iunn the collection, is
it ist name?

Thnaks for helping me how to identify an exiting node
regards
serge
Nov 22 '05 #1
2 2478
Hi Serge

If you are using the XML DOM... I believe that every XmlNode is a different
Object.... therefore two different nodes of the same type(or even identical)
will never match because they are different objects. I might be wrong
though!! so don't hold me back on it!!!

So... what I have done in my codes, to find similar nodes is to take a
target node to check for a duplicate....take a XmlNodeList of nodes to check
against... and compare their attributes...see if they have same number of
attributes.... if they have the same attribute names and values( remember
that attributes order might not match, alltought they are identical ).
That would do it if the nodes have no children.... but if they do.... that's
a whole other can of worms....

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:EF**********************************@microsof t.com...
Dear all,

I am populating a treeview control with an XML file.
I need to skip duplicate node entry from XML file in treeview if exit

For that I ma using the following line of code :

If NodeCollection.Contains(node) Then Return True

That function always return false.
If I go through nodeCollection object and check if my Node object exist I
can saee it already in the collection.

Why the Contains return always false ?
Waht is the criteria that identify an existing node iunn the collection,
is
it ist name?

Thnaks for helping me how to identify an exiting node
regards
serge

Nov 22 '05 #2
Hi Felipe,

OUps I am lost now.
ket me explain again, first here is below a sample of my XML node :
======================================
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<REC_INFO>
<FILE_NAME>REC00001.CSV</FILE_NAME>
<Type>Pipe</Type>
<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</MODIFIED>
</REC_INFO>
<REC_INFO>
=========================================

I van have many of those and I am building a treeview nodes only from the
xml node named <Type>. What you see above, I can get more, on the same file
with the same node name but different value.

For the <TYpe> node, If this node value has been already added previously in
my trreenode colection then I should skip it.

And this is what I ma try ing to do with the Contains function

Any other ideas how to do that?

thnaks for your help
"Felipe" wrote:
Hi Serge

If you are using the XML DOM... I believe that every XmlNode is a different
Object.... therefore two different nodes of the same type(or even identical)
will never match because they are different objects. I might be wrong
though!! so don't hold me back on it!!!

So... what I have done in my codes, to find similar nodes is to take a
target node to check for a duplicate....take a XmlNodeList of nodes to check
against... and compare their attributes...see if they have same number of
attributes.... if they have the same attribute names and values( remember
that attributes order might not match, alltought they are identical ).
That would do it if the nodes have no children.... but if they do.... that's
a whole other can of worms....

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:EF**********************************@microsof t.com...
Dear all,

I am populating a treeview control with an XML file.
I need to skip duplicate node entry from XML file in treeview if exit

For that I ma using the following line of code :

If NodeCollection.Contains(node) Then Return True

That function always return false.
If I go through nodeCollection object and check if my Node object exist I
can saee it already in the collection.

Why the Contains return always false ?
Waht is the criteria that identify an existing node iunn the collection,
is
it ist name?

Thnaks for helping me how to identify an exiting node
regards
serge


Nov 22 '05 #3

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

Similar topics

1
by: j-marvin | last post by:
hi- i have the following query as part of a basic search engine. it wont work at the web host. i have more code but this is the offending query. it works in the mysql control center. the...
5
by: Arjen | last post by:
Hi All, What I want to is using a string as PATTERN in a split function. This makes it possible for me to change the PATTERN on one place in my script... For example: $separator = ";"; $line...
3
by: Jason | last post by:
I am having trouble using the CONTAINS function in sql server(enterprise manager). I am typing the following: Select * FROM mytable WHERE CONTAINS(myfield,'mystring') This returns the...
2
by: serge calderara | last post by:
Dear all, I am populating a treeview control with an XML file. I need to skip duplicate node entry from XML file in treeview if exit For that I ma using the following line of code : If...
2
by: sprungli | last post by:
My goal is to select some XPath nodes based on whether their values (text) contain a string passed as argument. To achieve this I use the contains() function of XPath in an XpathExpression. For...
5
by: Jim | last post by:
Need help with aggregate function...for each unique product, I need the provider with the cheapest cost factor Here't the table (Table1) ID product provider factor 1 123456 abc...
5
by: Kendall | last post by:
Hi, My form is - a listbox which contains 5 items, a textbox and a button. ListBox - subjectListBox TextBox - subjectTextBox When the button is clicked, I want the 5 items in the listbox...
0
by: kc7zdm | last post by:
I'm using Oracle intermedia text indices in my database, and the Contains function from a VB.Net program using the system.data.oracleclient provider. When a query includes a number as a search term,...
4
by: Ram | last post by:
Hi All, Firstly i am a newbie and trying to learn C. The background of the problem is Program: Presently I am working on a program of numerology and the I/P will be the name and output...
8
by: SMJT | last post by:
Does anyone know why the string contains function always returns true if the token is an empty string? I expected it to return false. "AnyOldText".Contains("") or...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.