CDATA

A CDATA object is created by the newCDATA function, or a CDATA object in an template. A CDATA object is used to get limited control of rendering an XML document.

In an XML document, a CDATA section is used to disable the normal parsing of XML entities(i.e. elements and character entities). e.g. within a CDATA section you can include < and & without having to escape them.

Using CDATA objects allows MillScript to render better XML documents especially where you have text content that includes < or &.

The following example shows how you might construct and use a CDATA object.

:-) var cdata = newCDATA( "hello", <element><child>"<>"</child></element> );
There are 0 results
:-) xmlFile( "somefile.xml", <xml>cdata</xml> );
There is 1 result
/somefile.xml
      

The contents of the somefile.xml would look like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xml><![CDATA[hello<element><child><></child></element>]]</xml>