Message Sets: XML rendering options
You can use four properties on the XML layer that to affect how the XML messages are rendered.
The following table shows examples of the values that
you can set for the Member Render property.
In this table, the member element is referred to as A, and
has the value value of element
. The parent is referred
to as X.
The effect of rendering options on XML output
To get XML rendered like this: | Set this Member Render property value: | Set these other property values: |
---|---|---|
|
XMLElement (the default) | Member XML Name = A
|
|
XMLAttribute | Member XML Name = A
|
|
XMLElementAttrID | Member XML Name = Field
Member ID Attribute Name = id Member ID Attribute Value = A |
|
XMLElementAttrVal | Member XML Name = A
Member Value Attribute Name = val |
|
XMLElementAttrIDVal | Member XML Name = Field
Member ID Attribute Name = id Member ID Attribute Value = A Member Value Attribute Name = val |
You should not have an element in the model that is rendered as an XML attribute. This can result in incorrect validation of XML documents. Instead the element should be redefined as an attribute in the model.
You should not have an attribute in the model that is rendered as an XML element. This can result in incorrect validation of XML documents. Instead the attribute should be defined as an element in the model.
There is one scenario where this technique is appropriate. When you have created a message model by importing a C header file or a COBOL copybook, it will consist entirely of elements. An XML form of this model can be created by simply adding an XML physical format to the message set. If you are looking for certain elements to appear as XML attributes in the XML form, you can use the Render property to achieve this.