XML message encoding

For fields that are required in the schema, the Translation Configurator creates an empty element. An example of a required field is nillable=true. It does this in case there is no COPY, or other action to populate it. An empty element is also created if there is a COPY, or other, action that does not put any value in the element.

The element must be there, for the schema to be valid. When this happens, the Translation Configurator does not create an XML that does not validate against its schema.

When encoding an XML message, the schema is checked for elements and attributes that are required but not populated during translation. If found, then the engine automatically inserts an empty element or empty attribute in the XML message.

For elements, an element with no value is inserted if the element is a simpleType or if its nillable flag is true; otherwise, an empty structure is inserted.

For attributes, an attribute with no value is inserted.

Example

The schema is defined as:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
          <xs:element name="test">
                    <xs:complexType>
                              <xs:sequence>
                                        <xs:element name="RequiredElement1" minOccurs="2"
type="xs:string" maxOccurs="unbounded">
                                        </xs:element>
                              </xs:sequence>
                    </xs:compexType>
          </xs:element>
</xs:schema>  

Only the first repetition is populated:

COPY =ABC -> test.RequiredElement1(0).#text

The output is:

<test><RequiredElement1>abc</RequiredElement1><RequiredElement1/></test>

In this example, the empty element is automatically inserted by the engine.

Exceptions

There are a few exceptions in which the automatic insertion does not happen:

  • Abstract elements are not automatically inserted.
  • Elements whose type are abstract are not automatically inserted.
  • An ANY element is not automatically inserted.
  • For recursive elements, automatic insertion stops at the first repeated element encountered.
  • Only the first element displaying in the ALL groups are inserted. The rest are not automatically inserted.
  • Data type validations are not checked when the empty element or attributes are inserted. For example, if empty strings cannot be used in an attribute's data type, then an attribute with no value is inserted if the attribute is found missing.
Note: The inserted empty elements or attributes might cause the resulting XML to be invalid. You are responsible for making them valid by populating the correct values in translation.