473,399 Members | 2,159 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,399 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 2479
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: 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
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
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...
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
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...
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.