Special Character Must Be Replaced"
From Documentation
Maya001122 (talk | contribs) (Created page with '{{ZKDevelopersGuidePageHeader}} XML use <tt><''element-name''></tt> to denote an element, so you have to replace special characters. For example, you have to use <tt><</t…') |
m (correct highlight (via JWB)) |
||
Line 1: | Line 1: | ||
{{ZKDevelopersGuidePageHeader}} | {{ZKDevelopersGuidePageHeader}} | ||
− | XML use < | + | XML use <code><''element-name''></code> to denote an element, so you have to replace special characters. For example, you have to use <code>&lt;</code> to represent the <code><</code> character. |
Line 38: | Line 38: | ||
| Required only if use it in a XML attribute's value | | Required only if use it in a XML attribute's value | ||
|} | |} | ||
− | Alternatively, you could tell XML parser not to interpret a piece of text by using < | + | Alternatively, you could tell XML parser not to interpret a piece of text by using <code>CDATA</code> as the following. |
<source lang="xml" > | <source lang="xml" > | ||
Line 51: | Line 51: | ||
</source> | </source> | ||
− | It is suggested to always add < | + | It is suggested to always add <code><![CDATA[ ]]></code> inside your <code><zscript> </zscript></code>. Thus you don't have to worry about escape sequences for special characters like "&", "<". In addition, the code is much easier to read and maintain. |
{{ ZKDevelopersGuidePageFooter}} | {{ ZKDevelopersGuidePageFooter}} |
Latest revision as of 10:36, 19 January 2022
This documentation is for an older version of ZK. For the latest one, please click here.
XML use <element-name>
to denote an element, so you have to replace special characters. For example, you have to use <
to represent the <
character.
Required only if use it in a XML attribute's value | ||
Required only if use it in a XML attribute's value |
Alternatively, you could tell XML parser not to interpret a piece of text by using CDATA
as the following.
<zscript>
<![CDATA[
void myfunc(int a, int b) {
if (a < 0 && b > 0) {
//do something
}
]]>
</zscript>
It is suggested to always add <![CDATA[ ]]>
inside your <zscript> </zscript>
. Thus you don't have to worry about escape sequences for special characters like "&", "<". In addition, the code is much easier to read and maintain.