开发者

.Net's XmlElement doesn't encode apos and quot?

开发者 https://www.devze.com 2023-03-03 09:19 出处:网络
class C { [XmlElement(\"txt\")] public string Txt {get; set;} } When serializing the above with \' \" & < >, the output is \' \" &amp; &lt; &gt;
class C {
  [XmlElement("txt")]
  public string Txt {get; set;}
}

When serializing the above with ' " & < >, the output is ' " &amp; &lt; &gt;

Why 开发者_如何学Goisn't ' and " encoded to &apos; and &quot;?


Quotes must be encoded within attributes, its not required when inside an XML element text.

0

精彩评论

暂无评论...
验证码 换一张
取 消