Am un cod care returnează InnerXML pentru un XMLNode.
Nodul poate conține doar un text (cu HTML) sau XML.
De exemplu:
Here is some <strong>HTML</strong>
sau
Here is some content
if I get the InnerXML fsau
the HTML tags are returned as xml entities.
I cannot use InnerText because I need to be able to get the xml contents. So all I really need is a way to un-escape the HTML tags, because I can detect if it's xml sau not and act accsaudingly.
Cred că aș putea folosi HTMLDecode, dar va decoda toate entitățile codate XML?
Update: I guess I'm rambling a bit above so here is a clarified scenario:
Am un document xml care arată astfel:
<p>A Test</p>
A test
Daca eu fac:
XmlNode xn1 = document.SelectSingleNode("/content[@id=1]/data");
XmlNode xn2 = document.SelectSingleNode("/content[@id=2]/data");
Console.WriteLine(xn1.InnerXml);
Console.WriteLine(xn2.InnerXml);
xn1 va reveni
<p>A Test</p>
xn2 will return A test
Am verificat deja pentru a vedea dacă ceea ce este returnat este xml (în cazul lui xn2), deci tot ce trebuie să fac este să nu scap de & lt;
etc în xn1.
HTMLDecode does this, but I'm not sure it would wsauk fsau everything. So the question remains would HTMLDecode handle all the possible entities sau is there a class somewhere that will do it fsau me.