Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: LINQ to XML [Thread Next] Re: LINQ to XMLTo: NULL Date: 6/12/2008 10:27:00 AM
First, I tried this:
>>> Dim desc = item.Element("description").value
>>> Dim data = XElement.Parse("<data>" + desc.Value + "</data>")
>>> Console.WriteLine(data.Value)
And that produced the contents of the CDATA section (including markup).
But, now I've got it working as desired using this:
Dim cd As New XCData(item.Element("description").Value)
'Now, use System.Xml and the XML DOM to get the text out of the
CDATA section
Dim data As New Xml.XmlDocument
data.LoadXml("<data>" + cd.Value + "</data>")
Console.WriteLine(" {0}", data.InnerText)
Thanks for your help!
"Martin Honnen" <mahotrash@y...> wrote in message
news:e8niBaJzIHA.5816@T......
> Scott M. wrote:
>>> 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);
>>
>> After tweaking, I got this code running, but it doesn't strip out the
>> markup, which is what I want.
>
> Can you show us your code? My sample works for me as you described,
> outputting the text without markup.
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
