Skip to main content
Version: Next

SAX ADD XML CDATA

SAX ADD XML CDATA ( document ; data )

ParameterTypeDescription
documentDocRef🡒Reference of open document
dataBLOB, Text🡒Text or BLOB to insert in the document between CData tags

Description

In the XML document referenced by document, the SAX ADD XML CDATA command adds data of the text or BLOB type. This data will be automatically framed between the <![CDATA[ and ]]> tags.

The text included in a CData section is ignored by the XML interpreter.

If you want to encode the contents of data, you must use the BASE64 ENCODE command. In this case, of course, you must pass a BLOB in data.

In order for this command to operate correctly, an element must be open. Otherwise, an error will be generated.

Example

You want to insert the following lines in your XML document:

function matchwo(a,b)
{
if (a < b && a < 0) then
      {
      return 1
      }
else
      {
      return 0
      }
}

To do this, you just need to execute the following code:

 var vtMytext : Text
 ... // place the text in the vtMytext variable here
 SAX ADD XML CDATA($DocRef;vtMytext)

The result will thus be:

<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
   {
   return 1
   }
else
   {
   return 0
   }
}
]]>

System variables and sets

If the command has been executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0.

See also

SAX GET XML CDATA