4D v16.3

SAX ADD XML CDATA

Home

 
4D v16.3
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.



See also 

SAX GET XML CDATA

 
PROPERTIES 

Product: 4D
Theme: XML SAX
Number: 856

The OK variable is changed by the commandThis command can be run in preemptive processes

 
HISTORY 

Created: 4D 2004

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)