Special Characters and XML Strings

来源:互联网 发布:淘宝联盟的佣金在哪里 编辑:程序博客网 时间:2024/04/24 16:16
http://www.devx.com/tips/Tip/14068

XML has a special set of characters that cannot be used in normal XML strings. These characters are:

  1. & - &
  2. < - &lt;
  3. > - &gt;
  4. " - &quot;
  5. ' - &#39;

For example, the following XML string is invalid:

 <Organization>IBM & Microsoft</Organization>

Whereas the following is valid XML:

 <Organization>IBM &amp; Microsoft</Organization>
—Note that we have replaced '&' with '&amp;' in the second XML string which makes it valid.
原创粉丝点击