Hi I have an Xml document, read from file using
var doc = XDocument.Load(reader);
The xml looks like this,
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE document SYSTEM 'xmlschemas/some.dtd'>
<document xmlns='http://www.abcd.com/dxl' version='9.0' someversion='1.0' 
          replicaid='0xxxxDB' form='Test'>
   <item name='From'>
      <text>John Doe</text>
   </item>
   <item name='SentTo'>
      <text>Another John Doe</text>
   </item>
   <item name='ModTime'>
      <datetime dst='true'>20180129T114649,22-02</datetime>
   </item>
   <item name='Body' sign='true' seal='true'>
       <attachmentref name='some.pdf' displayname='some.pdf'>
           <picture height='34px' width='342px'>
                <notesbitmap>
                    lQAmAAAAAAAAAAAAAAABAAAAAAAAAFYBI
                </notesbitmap>
           </picture>
How do I parse such an xml using Linq while targeting 'item' tags having specific name attributes? Tried this with no success.,
 doc.Descendants("document")
 .Where(item =>
 {
    string cus = (string)item.Element("item");
    return cus != null && cus == "name";
 })
 .Descendants("SentTo")
 .Select(d => d.Value)
 .ToList();
I want to target item tags with name attributes 'From' and 'SentTo', there are other tags which I may not want to target. Thanks in advance.
 
     
     
    

 
    