xml节点含<![CDATA[]]>数据读取

一个简单的xml,如下所示:

<?xml version="1.0" encoding="GBK"?>
<Document>
    <ChiefComplaint>
        <![CDATA[右眼视力进行性下降2年余]]>
    </ChiefComplaint>
</Document>

我们该如何读取“

private int readxml()
        {
            string responseInfo = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
                                + @"<Document>
                                        <ChiefComplaint>
                                            <![CDATA[右眼视力进行性下降2年余]]>
                                        </ChiefComplaint>
                                    </Document>";


            XmlDocument doc = new XmlDocument();
            doc.LoadXml(responseInfo);
            string xpathChiefComplaint = "/Document/ChiefComplaint";

            XmlNode xnChiefComplaint = doc.SelectSingleNode(xpathChiefComplaint);

            string nodeValue = xnChiefComplaint.InnerText;
        }

以上代码就可以得到nodeValue 是“右眼视力进行性下降2年余”。

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念