4D v13.4

DOM Create XML element arrays

Home

 
4D v13.4
DOM Create XML element arrays

DOM Create XML element arrays 


 

DOM Create XML element arrays ( elementRef ; xPath {; attribNamesArray ; attribValuesArray} {; attribNamesArray2 ; attribValuesArray2 ; ... ; attribNamesArrayN ; attribValuesArrayN} ) -> Function result 
Parameter Type   Description
elementRef  Text in XML root element reference
xPath  Text in XPath path of the XML element to create
attribNamesArray  String array in Array of attribute names
attribValuesArray  String array in Array of attribute values
Function result  Text in Reference of created XML element

The DOM Create XML element arrays command is used to add a new element in the elementRef XML element, as well as, optionally, attributes and their values in the form of arrays.

Apart from supporting arrays (see below), this command is identical to DOM Create XML element. Please refer to the description of this command for the details of its functioning. 

Optionally, this command can be used to pass several pairs of attributes and attribute values as arrays in the attribNamesArray and attribValuesArray parameters. In attribValuesArray, you can pass arrays of the text, date, number, and picture type. 4D automatically carries out the necessary conversions; you can modify these conversions using the XML SET OPTIONS command.

The arrays must have been created beforehand and function by pairs. You can pass as many pairs of arrays and as many elements in each pair as you want.

Example  

We want to create the following element:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RootElement>
   <Elem1>
      <Elem2>
         <Elem3 Font="Verdana" Size="10" Style="Bold"></Elem3>
      </Elem2>
   </Elem1>
</RootElement>

For this, you can simply write:

 ARRAY TEXT(arrAttNames;3)
 ARRAY TEXT(arrAttValues;3)
 arrAttNames{1}:="Font"
 arrAttValues{1}:="Verdana"
 arrAttNames{2}:="Style"
 arrAttValues{2}:="10"
 arrAttNames{3}:="Style"
 arrAttValues{3}:="Bold"
 vRootRef:=DOM Create XML Ref("RootElement")
 vxPath:="/RootElement/Elem1/Elem2/Elem3"
 vElementRef:=DOM Create XML element arrays(vRootRef;vxPath;arrAttNames;arrAttValues)

 
PROPERTIES 

Product: 4D
Theme: XML DOM
Number: 1097

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v12

 
SEE ALSO 

DOM Create XML element