一、xml字符串里的特殊字符如何转义为xml格式
string xml="<?xml version=\"1.0\" encoding=\"utf-8\" ?><itemRule><field id=\"prop_13021751\" name=\"货号\" type=\"input\"><rules><rule name=\"requiredRule\"";
xml=System.Web.HttpUtility.HtmlDecode(xml);
//结果
xml:
<?xml version="1.0" encoding="utf-8" ?><itemRule><field id="prop_13021751" name="货号" type="input"><rules><rule name="requiredRule"
二、xml格式字符串特殊字符格式化
string xml="<?xml version=\"1.0\" encoding=\"utf-8\" ?><itemRule><field id=\"prop_13021751\" name=\"货号\" type=\"input\"><rules><rule name=\"requiredRule\"";
xml=System.Security.SecurityElement.Escape(xml);
//结果
xml:
<?xml version=\"1.0\" encoding=\"utf-8\" ?><itemRule><field id=\"prop_13021751\" name=\"货号\" type=\"input\"><rules><rule name=\"requiredRule\"