4D v13.4

SAX ADD XML CDATA

Home

 
4D v13.4
SAX ADD XML CDATA

SAX ADD XML CDATA 


 

SAX ADD XML CDATA ( document ; data ) 
Parameter Type   Description
document  DocRef in Reference of open document
data  BLOB, Text in Text or BLOB to insert in the document between CData tags

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:

 C_TEXT(vtMytext)
 ... ` 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
   }
}
]]>

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

 
PROPERTIES 

Product: 4D
Theme: XML SAX
Number: 856

The OK variable is changed by the command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D 2004

 
SEE ALSO 

SAX GET XML CDATA