XLINQ : how to exclude node in XML using XLINQ


XLINQ : how to exclude node in XML using XLINQ



hi i have the following xml

<students>   <student>     <id>12</id>     <name>Mohsan</name>   </student>   <student>     <id>2</id>     <name>Ali</name>     <address>       <country>Pakistan</country>     </address>     <address>       <country>India</country>     </address>     <parent>       <id>12</id>       <address>         <country>Pakistan</country>       </address>     </parent>   </student>   <student>     <id>3</id>     <name>Azhar</name>   </student> </students> 

i want to get the address of student only. not the address of its parent. i used this query

var stds = from std in doc.Descendants("student")                 select new                     {                         ID = std.Element("id").Value,                         Name = std.Element("name").Value,                         Address = from addr in std.Descendants("address")                                     select addr.Element("country").Value                     }; 

but this query returning me address of its parent too. which i dont want. note that a student can have multiple address. please tell me how to exclude the parent address at the time of retrieval..




Sudoku table generator failure, lisp

1:



Picolisp question, segfault when manipulating lists of numbers (from mailing list)
Use std.Elements("address") instead of std.Descendants("address") .
Is there a common lisp package naming convention?


lambda-gtk negative pointer


82 out of 100 based on 42 user ratings 592 reviews