create xml from node(a, b, c, d, e, f, g, h, i)
Group |
This function creates an XML file based on the node that is specified in parameter a. If no value is set in a, the node that contains the field with this function is used.
Description of Parameters
Parameter |
Description |
a |
(optional) Name of the node, from which the XML is created. If the parameter is left empty, the node on/under which the function is executed is used. Important note: If the root node uses a namespace, parameter c must be set to true. |
b |
(optional) true if no XML header should be created. Default: false. |
c |
(optional) If the memory-safe method used (parameter c=true), elements will be swapped to the file system during the creation of the XML. This is the preferred option for larger amounts of data. See parameter d. |
d |
(optional) When the memory-safe method is used (parameter c=true), this parameter defines the threshold value of elements at which the swapping to the file system starts. Default: 1000. |
e |
(optional) true to inherit namespaces from a node. Default: false. |
f |
(optional) true to also write the whitespaces of field values (even if there are only whitespaces). Default: false. |
g |
(optional) Replace field names D-_... and F-_... with _... (meaning: cuts off D- and F-). Default: false. |
h |
(optional) true to suppress defined namespaces. Default: false. |
i |
(optional) true to also write empty fields. Default: false. |
Parameter Description for XML Handling in the Target Tree
In order to control the structure of XML elements in the target tree, properties in the target structure nodes/fields and special fields with reserved suffixes are used.
Properties in Target Structure Nodes
XML Namespace: This property defines a namespace for the element which is created from the node where it is specified, e.g. soapenv . All elements contained in this node will get the same namespace as long as there is no other namespace set. If no namespace should be set, use DEFAULT as value.
XML/JSON handling: This property controls the way in which the node is added to the XML. The following settings are possible:
Normal: The node is created as an element in the XML.
Transparent: The node itself does not generate an XML element, but the content in the node is considered.
Exclude: The node is ignored in the generation.
Array: (This value is not relevant for this function.)
Array Transparent: (This value is not relevant for this function.)
Properties in Target Structure Fields
XML Namespace: This field property can be used to assign an XML namespace to the element that is crated from the field, e.g. soapenv . You can also define a new namespace in this property. Example: soapenv=http://schemas.xmlsoap.org/soap/envelope/ . If no namespace should be set, use DEFAULT as value.
Reserved Field Names for Additional Control
Within a target structure node, fields can be created, which allow further control. The following suffixes are reserved.
_val: A field with this suffix contains the value of the XML element.
_attr: (e.g. id_attr) With fields with this extension, attributes can be added to the XML element. In the example here, the attribute id would be added to the element.
_nsdef: (e.g. xsd_nsdef) Defines a namespace (xsd) in the XML element. The content of the field has to be the namespace, e.g. http://www.w3.org/2001/XMLSchema
_name: The value of this field is used as the name of the XML element instead of using the node name.
Example
In the following example, the four reserved field names were used. The node Rootnode is renamed into Envelope in the field Rootnode_name with a fixed value. The three namespaces are defined in the three fields wsdw_nsdef, xsd_nsdef and xsi_nsdef. The SoapRequest element gets the attribute ID with value 1 from field ID_attr. The field item_val contains the values of the item element. Field create_xml_from_node contains the described function. The following function parameters were used in the example.
Parameter a |
b |
c |
d |
e |
f |
g |
h |
i |
Rootnode |
|
|
|
|
|
|
|
|