LINQ Question

  • Thread starter Thread starter Scott M.
  • Start date Start date
S

Scott M.

How would I use LINQ to XML to extract just the text (not the markup) of the
following:

<description><![CDATA[<p><a
href="http://www.msnbc.msn.com/id/25085248/"><img align="left" border="0"
src="http://msnbcmedia.msn.com/j/msnbc/C...080610/g-080610-tec-tencent-4x3-10a.thumb.jpg"
alt="" style="margin:0 5px 5px 0" /></a>In an interview, David Hajdu, author
of the book "The Ten-Cent Plague: The Great Comic-Book Scare and How it
Changed America," discusses the rise and fall of the rise and fall of
comics, and how their unwelcome reception compares to today's criticism of
violent video games.</p><br clear="all" />]]></description>

In other words, I'm only interested in:

In an interview, David Hajdu, author of the book "The Ten-Cent Plague: The
Great Comic-Book Scare and How it Changed America," discusses the rise and
fall of the rise and fall of comics, and how their unwelcome reception
compares to today's criticism of violent video games.

Thanks.
 
How would I use LINQ to XML to extract just the text (not the markup) of the
following:

<description><![CDATA[<p><a
href="http://www.msnbc.msn.com/id/25085248/"><img align="left" border="0"
src="http://msnbcmedia.msn.com/j/msnbc/Components/ArtAndPhoto-Fronts/TECH/..."
alt="" style="margin:0 5px 5px 0" /></a>In an interview, David Hajdu, author
of the book "The Ten-Cent Plague: The Great Comic-Book Scare and How it
Changed America," discusses the rise and fall of the rise and fall of
comics, and how their unwelcome reception compares to today's criticism of
violent video games.</p><br clear="all" />]]></description>

In other words, I'm only interested in:

In an interview, David Hajdu, author of the book "The Ten-Cent Plague: The
Great Comic-Book Scare and How it Changed America," discusses the rise and
fall of the rise and fall of comics, and how their unwelcome reception
compares to today's criticism of violent video games.

Thanks.

I'm just wondering if a standard XmlNode's InnerText would grab that
without much trouble. Or maybe a cleverly written XPath query?
Hopefully Martin or one of the other Xml gurus will stop by, but to me
it doesn't seem like LINQ is the right solution here.

Thanks,

Seth Rowe [MVP]
 
Back
Top