[英]what is the best way to parse out CDATA inside XML tags
我需要在C#中解析以下XML:
<data>
<customer_id><![CDATA[1414301]]></customer_id>
<last_modified_date><![CDATA[2011-08-14 11:58:58]]></last_modified_date>
<customer_first_name><![CDATA[joe]]></customer_first_name>
<customer_last_name><![CDATA[blow]]></customer_last_name>
</data>
放入名為Result的對象
public class Result
{
public int customer_id;
public string customer_first_name;
public string customer_last_name;
}
我要確定的一件事是如何擺脫
<![CDATA[]]
並解析出常規值。
將XML轉換為上面支持CDATA語法的對象的最佳方法是什么?
不知道“解析”是什么意思。 如果使用XML DOM解析器(或任何其他類型),則可以透明訪問CDATA值。
使用System.XML嗎? 嘗試XmlCDataSection嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.