मेरे पास कुछ कोड है जो एक XMLNode के लिए InnerXML देता है।
नोड में केवल कुछ पाठ (HTML के साथ) या एक्सएमएल हो सकता है।
उदाहरण के लिए:
Here is some <strong>HTML</strong>
या
Here is some content
if I get the InnerXML fया
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 या not and act accयाdingly.
मुझे लगता है कि मैं HTMLDecode का उपयोग कर सकता हूं, लेकिन क्या यह सभी एक्सएमएल एन्कोडेड इकाइयों को डीकोड करेगा?
Update: I guess I'm rambling a bit above so here is a clarified scenario:
मेरे पास एक एक्सएमएल दस्तावेज़ है जो इस तरह दिखता है:
<p>A Test</p>
A test
यदि मैं करता हूँ:
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 वापस आ जाएगा
<p>A Test</p>
xn2 will return A test
मैं पहले से ही यह देखने के लिए जांच कर रहा हूं कि क्या लौटाया गया है एक्सएमएल (xn2 के मामले में) तो मुझे बस इतना करना है कि xn1 में & lt;
आदि से बचें।
HTMLDecode does this, but I'm not sure it would wयाk fया everything. So the question remains would HTMLDecode handle all the possible entities या is there a class somewhere that will do it fया me.