I can't remember of find, but I know there were a way using something like <[CODE to write code inside the xml without have problems with the xml reserved symbols.. Does anyone knows?
Asked
Active
Viewed 561 times
0
T.J. Crowder
- 959,406
- 173
- 1,780
- 1,769
The Student
- 26,271
- 66
- 155
- 257
-
See also: [When is a CDATA section necessary within a script tag?](http://stackoverflow.com/questions/66837/when-is-a-cdata-section-necessary-within-a-script-tag) and [Should I use “\]\]>” or “//\]\]>” for closing a CDATA section into xHTML](http://stackoverflow.com/questions/2375217/should-i-use-or-for-closing-a-cdata-section-into-xhtml) – Shog9 Sep 22 '10 at 16:26
1 Answers
5
Yep, using CDATA - http://www.w3schools.com/xml/xml_cdata.asp
Example:
<script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
{
return 1;
}
else
{
return 0;
}
}
]]>
</script>
T.J. Crowder
- 959,406
- 173
- 1,780
- 1,769
Lloyd
- 28,624
- 4
- 82
- 95
-
Took the liberty of copying the example to the answer, in case the link dies/gets moved/etc. – T.J. Crowder Sep 22 '10 at 15:28
-