If you have selected Message Protocol-File content conversion, you can convert an XML-compatible table into plain text format. The expected XML structure contains the structure as nodes filled with any number of elements without additional subnodes.
For example, you have an XML document with the following structure at runtime, and want to save it as a plain text file.
Example of a Simple XML Structure
The expected structure (Struc1) with elements (field1, field2, and so on) is referred to as an XML-compatible table. This structure corresponds to a line type in the target file and cannot contain any further subnodes. The Struc1 structure can, however, be contained in another structure, SuperStrucA.
Example of a Hierarchical XML Structure
12345678
<ns:DemoMsgTypeSuper xmlns:ns="urn:educationsap.com/bit/demo">
<SuperStrucA>
<Struc1>
<field1>value1</field1>
<field2>value2</field2>
</Struc1>
</SuperStrucA>
</ns:DemoMsgTypeSuper>
However, you do not have to take into account this higher hierarchy level of SuperStrucA in the configuration and the general file does not reflect this.
Design Time
Create a message type that references a complex data type in the ESR.
Simple Message Type demonsgtype1
Name | Category | Type | Occurrence |
---|
DemoMsgType1 | N/A | DT_Demo1 | N/A |
–Struc1 | Element | DT_Simple1 | 1...unbounded |
–––field1 | Element | xsd:string | 1 |
–––field2 | Element | xsd:string | 1 |
The simple data type DT_Simple1 has two fields. It is referenced by a data type DT_Demo1, which is then referenced in message type DemoMsgType1.
Configuration Time
To ensure that the fields of the structure are separate from one another each time when structure Struc1 occurs, you must first list the Struc1 structure in the recordset structure in the communication channel and then specify the fieldSeparator parameter in the Struc1.fieldSeparator form. This is the parameter for the character that is to be inserted between the fields.
Content Conversion Parameters
Name | Value |
---|
Struc1.fieldSeparator | , |
Recordset Structure: | Struc1, Struc2 |
Hint
If you want a parameter, for example, .fieldSeparator to be initial (that is, without content), specify the value '0' (including the quotation marks).
Result for a Simple XML Structure
Different Structures
If several different structures appear in the XML document, you must define each structure as a recordset and configure it so that it is possible to generate a plain text file with lines using these structures.
For example, you have an XML document with the following structure at runtime and want to save it as a plain text file.
Example for Multiple Structures
Hint
There are two different structures, Struc1 and Struc2. The following statements also apply if there are more structures, Struc3, Struc4, and so on.
Design Time for Two Complex Data Types
Create a message type that references the two complex data types in the ESR.
Complex Message Type demomsgtype2
Name | Category | Type | Occurrence |
---|
DemoMsgType2 | N/A | DT_Demo2 | N/A |
– Struc1 | Element | DT_Simple1 | 1...unbounded |
–– field1 | Element | xsd:string | 1 |
–– field2 | Element | xsd:string | 1 |
– Struc2 | Element | DT_Simple2 | 1...unbounded |
–– fieldA | Element | xsd:string | 1 |
–– fieldB | Element | xsd:string | 1 |
–– fieldC | Element | xsd:string | 1 |
There is a complex data type DT_Demo2 that references the simple data type DT_Simple1, which has two fields, and DT_Simple2, which has three fields.
Configuration Time – Two Structures
List both structures, that is, Struc1 and Struc2 as recordset structures and configure them.
Content Conversion Parameters
Name | Value |
---|
Recordset Structure: Struc1, Struc2 |
Struc1.fieldSeparator | , |
Struc2.fieldSeparator | : |
Result for Multiple Structures