I have string s and it looks:
<root><p>hello world</p> my name is!</root>
I have next code:
try
{
m_Content = XDocument.Load(new StringReader(s));
}
catch (XmlException ex)
{
ex.Data["myerror"] = s;
throw;
}
As you see, I want to load string with all elements like
and make it view. But I've got XmlException:
Reference to undeclared substitution to "nbsp"
Any ideas how to do it right?
Added
ChrisShao offered a good idea: put my string in <![CDATA[
tag, but unfortunately it doesnt solve my problem. I have a big string with lots of tags and few big texts in which I can meet
elements. If use System.Web.HttpUtility.HtmlDecode
I lose all these elements and get " " fields.