4D v16.3

SAX ADD XML ELEMENT VALUE

Home

 
4D v16.3
SAX ADD XML ELEMENT VALUE

SAX ADD XML ELEMENT VALUE 


 

SAX ADD XML ELEMENT VALUE ( document ; data {; *} ) 
Parameter Type   Description
document  DocRef in Reference of open document
data  Text, Variable in Text or variable to insert in the document
Operator in If passed: encoding of special characters If omitted: no encoding

In the XML document referenced by document, the SAX ADD XML ELEMENT VALUE command adds data directly without converting them. This command is equivalent, for instance, to inserting an attachment in the body of an e-mail.

In data, you can either pass a character string directly, or a 4D variable. The variable contents will be converted into text before being included in the XML document.
If you want to encode the contents of data, you must use the BASE64 ENCODE command. In this case, of course, you must passs a BLOB in data.

By default, the command encodes special characters (< > ” ’...) contained in the data parameter unless you have disabled this mechanism for the current process using the XML SET OPTIONS command by passing the XML raw data value to the XML string encoding option. For example:

 XML SET OPTIONS($docRef;XML string encoding;XML raw data)

In this context, to force the encoding of special parameters when calling SAX ADD XML ELEMENT VALUE, you must pass the optional * parameter.

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

Example  

This example inserts the whitepaper.pdf file into the open XML element:

 C_BLOB(vBMyBLOB)
 DOCUMENT TO BLOB("c:\\whitepaper.pdf";vBMyBLOB)
 SAX ADD XML ELEMENT VALUE($DocRef;vBMyBLOB)

If the command has been executed correctly, the system variable OK is set to 1; otherwise, it is set to 0 and an error is generated.



See also 

SAX GET XML ELEMENT VALUE
XML SET OPTIONS

 
PROPERTIES 

Product: 4D
Theme: XML SAX
Number: 855

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

 
HISTORY 

Modified: 4D v11 SQL
Modified: 4D v12

 
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)