version 2004
SAX ADD XML CDATA (document; data)
Parameter | Type | Description | |
document | DocRef | Reference of open document | |
data | Text | BLOB | 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 </CData> 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 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:
C_TEXT (vtMytext) ... ` place the text in the vtMytext variable here SAX ADD XML CDATAL($DocRef;vtMytext)
The result will thus be:
<![CDATA[ function matchwo(a,b) { if (a < b && a < 0) then { return 1 } else { return 0 } } ]]>
See Also
System Variables or Sets
If the command has been executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0.