how to test if attribute in sibling nodes have same value

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 ***
0
5/5/2006 3:01:22 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
569 Views

Similar Articles

[PageSpeed] 36


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/
0
mahotrash (1777)
5/5/2006 3:43:27 PM
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 ***
> 
0
dskcheck (22)
5/9/2006 9:48:01 AM
Reply:

Similar Artilces:

Obtain Top Value from Table
I am attempting to pull a random set of records using a Random Number and the Top Value function. The Top Value changes depending on the specific group I am looking at so I would like to obtain the Top Value from a table rather than entering manually. First, the appropriate statistically significant sample size is determined for each group in my table by the query below. The sample size and group information are added to [tbl_tt_sample_size]. INSERT INTO tbl_tt_sample_size ( MonthSample, Code, Fac, Sample ) SELECT DateSerial(Year(Date()),Month(Date()),0) AS MonthSer, tbl_t...

Allow Outlook clients to modify GAL attributes
- Outlook clients are able to modify disto lists using Outlook (if they are the owner of the DL) - Users have permission to modify their own phone number in AD So why can't users change their phone number using Outlook? -- jj On Thu, 16 Feb 2006 10:45:30 -0800, "j" <j@discussions.microsoft.com> wrote: >- Outlook clients are able to modify disto lists using Outlook (if they are >the owner of the DL) >- Users have permission to modify their own phone number in AD > >So why can't users change their phone number using Outlook? They can. They nee...

Array Constant: How do I reference each value in a formula
I have an array constant {1000,1.2,2%} in cell A1 S = 1000 P = 1.2 R = 2% How do I reference the array constant to create this formula: =(S/P)-((S/P)*R) Hi, I can't duplicate your entry. First, to be an array it must be entered starting with an = for example ={1,2,3} Second, you show the last argument as 2% - Excel won't accept the % in and array entry. Maybe you are typing {1000,1.2,2%} into the cell? If so, it is not an array, its just a bunch of text. You could enter it as ={1000,1.2,0.02} -- Thanks, Shane Devenshire "notso" wrote: > I have an array co...

Prevent cells with no value from being plotted on chart
I have a chart based on cells that are the result of a calculation. The cells show empty if the data used for the calculation is not yet available (future data). As a result, as my chart shows the whole year, the line drops and remains to zero after the last available set of data. Excel will let me prevent an empty cell of being plotted but since there is a fornmula is the cell, it is not considered empty, and therefore displayed. How can I prevent these cells to be plotted on the chart? Thanks Vince You can use an IF formula with NA(). For example: =IF(B2="",NA(),B...

Finding a particular non zero value from a list
I have a column of formulas. The data I am entering will give a result for each of the formulas sequentially ie there no nonzero results up to a point. What I need to know is where the nonzero results start and to log the last nonzero value. The column of formulas is 50 deep. I was thinking take the average and where the average rises above zero that cell would be the cell I am after but is there a better way? --- Message posted from http://www.ExcelForum.com/ ...

enter 2 values in opposite corners of a cell
Is this possible? I've seen it on Excel (hardcopy) documents before, where the cell is split with a diagonal line, but am unsure how it's done ... if at all possible. (I know how to put the diagonal line in the cell.) Can it be done, or has the author done some other type of tweaking to the worksheet which is outside of Excel's typical functionality? -- itsthebike ------------------------------------------------------------------------ itsthebike's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=27425 View this thread: http://www.excelforum.com/showt...

Deploying crm data from Test system to Production system
Hi all, Can any one help me how I can deploy my developer system to Production system. I customize forms and enter data on Test system and test data base. How can I deploy my forms and data into Production system and production data base. Please help me soon . thanks in advance miiku Have a look to the 'redeployment tool' I think that what u need ! "aka" wrote: > Hi all, > Can any one help me how I can deploy my developer system to Production > system. > I customize forms and enter data on Test system and test data base. How can > I deploy my form...

Serialization with XmlSerializer: how to set the XML root node to something different from <ArrayOfClassname>????
Hello, when serializing an array of elements of a class Classname using XmlSerializer.Serialize() I get an XML like the following: <?xml version="1.0"> <ArrayOfClassname> ....... ....... </ArrayOfClassname> I'd like to be able to set the XML root node to something different from <ArrayOfClassname> .... for example something like <Classnames>. As an alternative when deserilizing an XML such as the following: <?xml version="1.0"> <Classnames> ....... ....... </Classnames> I'd like to be able to "load" it i...

Code to Query SQL Server with a parameter value (entered into an Input Box), and have that value also display in a selected cell on a worksheet
I'm wondering how BEST to accomplish this. I have a EXCEL workbook which populates data to, and retrieves data from SQL Server. I currently have VBA code which effectively sends the data from the EXCEL worksheet to SQL Server tables -- no problem with this. I currently have VBA code which effectively retrieves data from SQL Server and displays that data back into the worksheet -- no problem with this either. I'm currently using a Command Button (on-click event) and the code below to query SQL Server to determine the Max Version Number and add 1 to that value. This value is t...

Compare columns pull unique values and first duplicate value
I have 2 worksheets: First worksheet, 1st column has department abbreviations, 2nd columns has the formal department names names Second worksheet, 1st column has abreviations, 2nd column contains department nicknames, 3rd column contains floor space by the floor for each department, 4th column contains the total workspace for each department. (I did a vlookup to sum floors) On a new worksheet First column compare abreviations from first column in other worksheets and return the nickname (unique values and first duplicate) and in the Second column return the total workspace for the departmen...

merge multilple data values
how would I merge multilple data values: in seperate columns as: js-1234 to .jpg Thanks Hi Jennifer, ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ Hi Jennifer, Try using =(A1&B1) where A1 and B1 are the cells where your data sits ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ X-No-Archive: yes "Jennifer Burnel" <jenny@...

PJS2003
We have a couple plans that have their actual work values matching in the portfolio analyzer view. They stopped updating. They seem to be plans that were "saved as" another plan and then republished under the new name. Once the "Save as" another plan was completed, the olap work value stayed the same as the original plan's work value and did not continue updating with actual work reported. Is there a way to detached the "saved as" plan from it's original values in the OLAP cube? Example Project A has 5 hours total in Work on the Portfo...

INVESTMENT: 0 quantity, 1 cent value?
Help: I had two 401(k) mutual fund investments that I contributed to over a great deal of time. Recently I sold the entire positions of both and bought different funds. Now, for these two investments, the reports section of Money 02 is showing 0 quantity, but 1 cent value for each. As a result, I cannot delete these two investments from my investments list, as it says I still have positions in them. So why would Money show a value and say I have a position in an investment that has no quantity, and how do I get rid of this? Thanks, Because it has some non-zero amount that is very, very...

TAG value problem/SET Tag value
i get an error message: method or data member not found: Assessment is a combo box and field name in which the user is storing a diagnosis test description. maybe the problem is the AFTERupdate part of the code: Private Sub Combo_assessmt_AfterUpdate() Dim db As Database Dim rs As DAO.Recordset Dim strSQL As String Set db = CurrentDb strSQL = "SELECT diagcode " & _ "FROM diagnosis " & _ "WHERE diagname = '" & Me!assessment & "'" Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot) Me.assessment.Tag = Nz(rs!d...

Removing Exchange Attributes
Does anyone know of a script to automate the removal of exchange attributes for users? Thank You Paul You can use ADModify.net to do it in bulk..... http://www.gotdotnet.com/workspaces/workspace.aspx?id=f5cbbfa9-e46b-4a7a-8ed8-3e44523f32e2 "Paul Glickenhaus" <PaulGlickenhaus@discussions.microsoft.com> wrote in message news:FBF25773-4D0B-4DA7-803C-9335E4069319@microsoft.com... > Does anyone know of a script to automate the removal of exchange > attributes > for users? > > Thank You > > Paul ...

test to see if string matches with cell content
If I have the following content in a cell: foo bar star I'm wondering if there's a formula that will test to see if the string "bar" exists in the cell, and then return true or false (true in this example). =isnumber(search("bar",a1)) Use =find() instead of =search() if your search should be case sensitive. Another non-case sensitive function: =countif(a1,"*bar*")>0 or if x99 held bar: =countif(a1,"*"&x99&"*")>0 eggman2001 wrote: > > If I have the following content in a cell: > foo bar st...

How do I set up having a letter = a value?
I want to know if there is a way to type a letter in a column and make it represent a value. For example. If I type the letter b in column e1 I want it to represent a formula in c1. I am setting up a spreadsheet for my co workers to use and want it to be user freindly so they can type either a or b in a column and have it calculate the correct formula. =IF(E1="a",formula1,IF(E1="b",formula2,"")) Regards, Peo Sjoblom "kfoix" wrote: > I want to know if there is a way to type a letter in a column and make it > represent a value. For exa...

Summing up values only if month = *any month*
I'm fairly new to excel programming. What I have is: one column that displays dates and the one next to it display values in currency type eg: 04-Jan-2004 | 80 03-Apr-2004 | 25 05-Apr-2004 | 45 06-Jun-2004 | 35 In another column, I want: if Month is april on the first column, then, sum the values only from this row. As it is now, I get an error since I'm using Month(C2:C5) and it seems like Month doens't like the group values. Second, even if it works, it'd get the sum from all the rows... Which function would help me doing this? Many Thanks!!!! ** Posted via: http://...

#VALUE! ?
for some reason some of my cells now show #VALUE! in them, i have not changed anything. all i have done is use the file on one pc, copy to floppy and use on another pc, any ideas how to fix this? the cells in question have forumlas like; C72=SUM(C3:C71) C89=C72 Many thanks, Steve Hi Steve does htting F9 or CTRL+ALT+F9 solve this error? -- Regards Frank Kabel Frankfurt, Germany Steven wrote: > for some reason some of my cells now show #VALUE! in them, i have not > changed anything. all i have done is use the file on one pc, copy to > floppy and use on another pc, any ideas how...

value box next to the legend box
Hi, I have a pie chart with 15 different items. 3 of them are big and the rest are very small. I can present the values for the big slices but it is very messy for the little slices. Can I show next to the legend box also a value box that will be located parralel (with matching colours and of course related to the data by a formula)? Thanks, Tamir begin 666 values next to legend.xls MT,\1X*&Q&N$`````````````````````/@`#`/[_"0`&```````````````! M`````0``````````$ ``50````$```#^____``````````#_____________ M_________________________________________________...

Display required succeeding cells value if a cell value A1 is capt
Hi All, I'm a baby to Excel Programming. But I've to programme Excel 2003 work book in order that if sth is typed in the text box control. The code searches all the worksheets and displays the value in the label control. I've a textbox control, label control and a command button control in Sheet 1 Now with the below mentioned codes I suceeded to retrieve a cell value in a lable control.eg:A1. But the problem is, I've no idea to display all the cells value(B1 to H1) of that row from where the cell in a row, a data was retrieved. Any Idea!! Please Hel...

Inventory Values Copied from Old into New Items
Guys, When I use the Copy function to create new items from older items, the invenory values are carried over. In other words, the On Hand, Committed... field values under the Inventory tab are the same as the source item. Now, this cannot be correct behaviour, since a new item is independent onto its own, with its inventory quantities totally unrelated to the item from which it was originally copied. Anybody has come across this before? How can I set this right? Thanks, This is a multi-part message in MIME format. ------=_NextPart_000_0053_01C92EF5.0E1EBB10 Content-Type: text/plai...

keep formula after typing in a value in a excel cell
Hi there, my problem is, that i need something like: there is a function in a excel-cell (for example '=setvalue("sqlserver", "DB", "table")'). now i type in a value (for example 100) then the function "setvalue" must write this value (100) in the server, db and table from the parameters. after leaving the cell the formula is still the same and only the value 100 ist visible for the user. and if i go back to the cell than i can see the function in the menubar. there is a product from applix (TM1) and they did it. the problem is, that the souce...

SMTP messages sent through physical node not Cluster name/ip
We have multiple exchange servers and few exchange clusters spread on various geographical locations. All SMTP traffic is passed through a "internet connector" via bridgehead server to a third party mail scan server. All but one cluster is having this issue.. SMTP messages are received by the virtual cluster name/ip but it sends them through the physical node's ip (active node in a 2 node cluster config) which is creating issues with the third party scan server. Looking for some information on how to resolve this issue. Thank You. Does that Node have more than two (2) ...

Test
�����, �����, �����......... ...