Xml CData的使用 获取原始的节点内容


string withoutCdata ="" +
            "";

        XmlDocument doc = new XmlDocument();
        doc.LoadXml(withoutCdata);

        string value = doc.SelectSingleNode("result/data").InnerText;
        //value = alert(\"\");,其中““会被处理掉,得不到全部的节点内容

        string withCdata = "" +
            "alert(\"\");]]>";
        doc.LoadXml(withCdata);

        string oriValue = doc.SelectSingleNode("result/data").InnerText;
            //oriVale = ,这样就取到全部的节点内容了


你可能感兴趣的:(c#,编程)