how to Select Parent Element that contains another elements with specific value ?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello All ,
i have Xml File



<div style="text-indent:-21px
<div style="color:Black;background-color:White; <pre>
- <span style="color:Blue; <<span style="color:#A31515; Disorders<span style="color:Blue; >
- <span style="color:Blue; <<span style="color:#A31515; Disorder <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; A<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleA<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleB<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleC<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleD<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Disorder<span style="color:Blue; >
- <span style="color:Blue; <<span style="color:#A31515; Disorder <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; B<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleA<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleF<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleC<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleE<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Disorder<span style="color:Blue; >
- <span style="color:Blue; <<span style="color:#A31515; Disorder <span style="color:Red; Name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; C<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleD<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleS<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleR<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Tuple<span style="color:Blue; >TupleE<span style="color:Blue; </<span style="color:#A31515; Tuple<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Disorder<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Disorders<span style="color:Blue; >

[/code]
<br/>

i want to select each Disorder that has Tuple with value TupleA
<br/>

i used this query
<br/>


<pre> var Temp = xDoc.Elements("Disorders").Select(m => m.Elements().Select(s=>s.Value = "TupleA"));[/code]

but it returns the value of tuple itself
but i want to retrieve the disorder name
<br/>

<br/>

thanks in advance
<br/>



<hr class="sig Kareem Naguib

View the full article
 
Back
Top