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

how to test if attribute in sibling nodes have same value

K B
I bit new to this. My xml files contains the following nodes:

<root>
<WI Title="Test1">
<Role Name="Legal"/>
<Role Name="PM"/>
</WI>
<WI Title="Test1">
<Role Name="Legal"/>
<Role Name="Legal"/>
</WI>
<WI Title="Test1">
<Role Name="PM"/>
<Role Name="PM"/>
</WI>

I need to return the Title attribute of the WI where there is duplicate
<Role> elements with the same Name attribute.

I need to tel lthe user that WI titled "Test1" has two "Legal" roles
assigned.

I've only gotten this far...create a nodelist of the WI elements...what
next?

nodelist = xDoc.SelectNodes("//WI")
For Each node In nodelist
.....
Next

Any help appreciated.
Thanks, Kit

*** Sent via Developersdex http://www.developersdex.com ***
May 5 '06 #1
2 1450


K B wrote:
<root>
<WI Title="Test1">
<Role Name="Legal"/>
<Role Name="PM"/>
</WI>
<WI Title="Test1">
<Role Name="Legal"/>
<Role Name="Legal"/>
</WI>
<WI Title="Test1">
<Role Name="PM"/>
<Role Name="PM"/>
</WI>

I need to return the Title attribute of the WI where there is duplicate
<Role> elements with the same Name attribute. nodelist = xDoc.SelectNodes("//WI") xDoc.SelectNodes("root/WI[Role[1]/@Name = Role[2]/@Name]/@Title") For Each node In nodelist


node.NodeValue
gives you e.g. Test1.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 5 '06 #2
Hey,

do you want to check for the duplicate values in name attribute, or only the
given value, (ie., Legal ) to find out for number of occurences?

Ping for code support?
--
Every thing is perfect, as long as you share!!!
"K B" wrote:
I bit new to this. My xml files contains the following nodes:

<root>
<WI Title="Test1">
<Role Name="Legal"/>
<Role Name="PM"/>
</WI>
<WI Title="Test1">
<Role Name="Legal"/>
<Role Name="Legal"/>
</WI>
<WI Title="Test1">
<Role Name="PM"/>
<Role Name="PM"/>
</WI>

I need to return the Title attribute of the WI where there is duplicate
<Role> elements with the same Name attribute.

I need to tel lthe user that WI titled "Test1" has two "Legal" roles
assigned.

I've only gotten this far...create a nodelist of the WI elements...what
next?

nodelist = xDoc.SelectNodes("//WI")
For Each node In nodelist
.....
Next

Any help appreciated.
Thanks, Kit

*** Sent via Developersdex http://www.developersdex.com ***

May 10 '06 #3

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

Similar topics

3
by: Jorn W Janneck | last post by:
hello everyone. i have the sort of question that makes me feel like i am missing the forest for the trees, so apologies if i am missing the blatantly obvious here. i am using saxon, and mostly...
9
by: Iain | last post by:
I want to create an XML configuration file which might look like <REGION Name="Europe" WingDing="Blue"> <COUNTRY Name="UK" WingDing="white"> <TOWN Name="London" WingDing="Orange" /> </COUNTRY>...
4
by: n_o_s_p_a__m | last post by:
My xml doc has many <title></title> and <title> in it, meaning the nodes have no content (although some do). How can I test for this? I tried title (doesn't work) I tried //title (doesn't work)...
4
by: elora_c | last post by:
I'm trying to write XSLT that will filter out an XML based on an attribute's value. XML looks like: <postings> <channel name="A"> <posting Connected="True" name="Posting1" /> <posting...
0
by: noureensyed | last post by:
Hi there, Any ideas on how to sort an xml of the type below. I want to output the exact same xml as well just sorted. However in my case I want to select a particular column tag below, say...
2
by: Greg | last post by:
Hi. I have a rather large xml document (object) that can have one or more nodes with a certain attribute throughout (at ANY depth, not at the same level necessarily). I need to find this...
1
by: christoffer.lantz | last post by:
Howdy folks. Would anyone care to suggest a way to have sibling nodes (at the same level) collapse when a node is expanded in an asp.net 2.0 treeview control? What I mean is that I want only one...
0
by: smoother | last post by:
Hello, I'm new to XML Schema. I've already read the Schema tutorial at w3schools.com but I still have numerous questions: First, I want to let you know what my XML file looks like: <root...
3
by: patrizio.trinchini | last post by:
Hi, how can remove sibling elements based on the value of an attribute ? For instance, gven the XML document: <root> <parentElment> <testElement name="A"> <removableElement/>
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.