Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: LINQ to XML

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 6/12/2008 1:20:00 PM

Scott M. wrote:
> How would I use LINQ to XML (vb .net) 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/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>

Here is how you can do it, using Joe's suggestion:

             XElement desc = XElement.Load(@"file.xml");
             XElement data = XElement.Parse("<data>" + desc.Value + 
"</data>");
             Console.WriteLine(data.Value);




-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent