<h2 style="font-size: 14px; text-align: left; background-color: #f9f9f9; padding: 0px; margin: 0px;">CDATA</h2>
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">在 XML 元素中,"<" 和 "&" 是非法的。
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">"&" 也会产生错误,因为解析器会把该字符解释为字符实体的开始。
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">CDATA 部分中的所有内容都会被解析器忽略。
<pre><script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
{
return 1;
}
else
{
return 0;
}
}
]]>
</script>
</pre>
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">在上面的例子中,解析器会忽略 CDATA 部分中的所有内容。
<h3 style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 12px; text-align: left; background-color: #f9f9f9; padding: 0px;">关于 CDATA 部分的注释:</h3>
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">标记 CDATA 部分结尾的 "]]>" 不能包含空格或折行。
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">在 XML 元素中,"<" 和 "&" 是非法的。
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">"&" 也会产生错误,因为解析器会把该字符解释为字符实体的开始。
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">CDATA 部分中的所有内容都会被解析器忽略。
<pre><script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
{
return 1;
}
else
{
return 0;
}
}
]]>
</script>
</pre>
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">在上面的例子中,解析器会忽略 CDATA 部分中的所有内容。
<h3 style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 12px; text-align: left; background-color: #f9f9f9; padding: 0px;">关于 CDATA 部分的注释:</h3>
<p style="margin-top: 12px; line-height: 18px; text-align: left; background-color: #f9f9f9;">标记 CDATA 部分结尾的 "]]>" 不能包含空格或折行。