473,950 Members | 39,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SelectNode s("//WI")
For Each node In nodelist
.....
Next

Any help appreciated.
Thanks, Kit

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


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.SelectNode s("//WI") xDoc.SelectNode s("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.SelectNode s("//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
4979
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 xslt version 1.1 (the unofficial one). i have a template parameter, say v, which contains a sequence of nodes of the same kind, say A, which all have an attribute, say n. these attributes may have different numeric values. i have identified the...
9
2905
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> </REGION> <REGION Name="NorthAmerica" WingDing="Yellow"> <COUNTRY Name="Canada"> <TOWN Name="Quebec" WingDing="Brown" />
4
62617
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) I tried //title (doesn't work) I tried //title (doesn't work) Any suggestions welcome.
4
2036
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 Connected="False" name="Posting2" /> </channel> <channel name="B"> <channel name="C">
0
1268
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 "Last Name" and then sort all row by the VALUE attribute of this particular column. So I have to first check
2
10711
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 attribute and remove the containing node (and child nodes) if it has a certain value. I'm able to find the attributes using an XmlTextReader. Once found, can someone help me get the XPath at that point? I would then use this to remove the node from...
1
1836
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 subtree to be open at a time. Can the treeview control do this by itself or is some fiddeling required? Regards, Lantz
0
944
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 template="rootpage"> <page1 template="journal"> <entry1027 template="entry" title="title for entry no. 1027">...</entry1027> <entryAlpha template="entry" title="some other
3
2752
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
9991
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
11595
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
11191
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
10702
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
9904
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
7442
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
6231
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6352
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4959
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

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.