EDN Admin
Well-known member
i have this xml file
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; windows-1256<span style="color:Black; " <span style="color:Blue; ?>
- <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; >Tuple<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; >Tuple<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; >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; >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]
i have tried to use Linq to retrieve data from it
and it works well until i use where clause
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; var temp = <span style="color:Blue; from m <span style="color:Blue; in xDoc.Elements(<span style="color:#A31515; "Disorders").Elements(<span style="color:#A31515; "Disorder").Elements(<span style="color:#A31515; "Tuple") <span style="color:Blue; select m.Parent.Attribute(<span style="color:#A31515; "Name");
<span style="color:Green; // the above code works very well
<span style="color:Green; // but when i start to filter retrieved data it always return null
<span style="color:Blue; var temp = <span style="color:Blue; from m <span style="color:Blue; in xDoc.Elements(<span style="color:#A31515; "Disorders").Elements(<span style="color:#A31515; "Disorder").Elements(<span style="color:#A31515; "Tuple")
<span style="color:Blue; where m.Value==<span style="color:#A31515; "TupleA" <span style="color:Blue; select m.Parent.Attribute(<span style="color:#A31515; "Name");
<span style="color:Green; //the above code always return null
[/code]
whats wrong with this code ?
<hr class="sig Kareem Naguib
View the full article
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; windows-1256<span style="color:Black; " <span style="color:Blue; ?>
- <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; >Tuple<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; >Tuple<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; >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; >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]
i have tried to use Linq to retrieve data from it
and it works well until i use where clause
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; var temp = <span style="color:Blue; from m <span style="color:Blue; in xDoc.Elements(<span style="color:#A31515; "Disorders").Elements(<span style="color:#A31515; "Disorder").Elements(<span style="color:#A31515; "Tuple") <span style="color:Blue; select m.Parent.Attribute(<span style="color:#A31515; "Name");
<span style="color:Green; // the above code works very well
<span style="color:Green; // but when i start to filter retrieved data it always return null
<span style="color:Blue; var temp = <span style="color:Blue; from m <span style="color:Blue; in xDoc.Elements(<span style="color:#A31515; "Disorders").Elements(<span style="color:#A31515; "Disorder").Elements(<span style="color:#A31515; "Tuple")
<span style="color:Blue; where m.Value==<span style="color:#A31515; "TupleA" <span style="color:Blue; select m.Parent.Attribute(<span style="color:#A31515; "Name");
<span style="color:Green; //the above code always return null
[/code]
whats wrong with this code ?
<hr class="sig Kareem Naguib
View the full article