title: Extracting inner value on CDATA with Linq to XML using a filter
body: <p>I am using this code to retrieve the values I want from XML:</p>
  
  <pre><code>IEnumerable&lt;ForewordReview&gt; reviews = null;
  try
  {
      reviews = from item in xmlDoc.Descendants("node")
                select new ForewordReview()
                {
                    PubDate = item.Element("created").ToString(),
                    Isbn = item.Element("isbn").ToString(),
                    Summary = item.Element("review").ToString()
                };
  } // ...
  </code></pre>
  
  <p>Incidentally, a client is now passing us almost every tag with CDATA which I need to extract:</p>
  
  <pre><code>&lt;review&gt;
      &lt;node&gt;
          &lt;created&gt;
              &lt;![CDATA[2012-01-23 12:40:57]]&gt;
          &lt;/created&gt;
          &lt;isbn&gt;
              &lt;![CDATA[123456789]]&gt;
          &lt;/isbn&gt;
          &lt;summary&gt;
              &lt;![CDATA[Teh Kittehs like to play in teh mud]]&gt;
          &lt;/summary&gt;
      &lt;/node&gt;
  &lt;/review&gt;
  </code></pre>
  
  <p>I have seen a couple of solutions for extracting these values from within the CDATA tag, one of which is to use a where clause on the LINQ statement:</p>
  
  <pre><code>where element.NodeType == System.Xml.XmlNodeType.CDATA
  </code></pre>
  
  <p>I sort of see whats going on here, but I am not sure this works with how I am using Linq (specifically, building an object from selected items.</p>
  
  <p>Do I need to apply this filter on the items in the select statement individually? Otherwise, I dont really understand how this will work with the code I am using.</p>
  
  <p>As always, I appreciate the help.</p>