IBM Support

Restrictions in the processing of namespaces and qualified XML elements in generated XML-COBOL data conversion programs

Question & Answer


Question

Are there any restrictions in the processing of namespaces and qualified XML elements in the XML-COBOL data conversion programs that are generated for single-service projects?

Answer

The processing of namespaces and qualified elements in the generated XML-COBOL conversion programs has the following restrictions:

=========================================
1. INBOUND CONVERSION:

The following restrictions apply to inbound conversion (XML to COBOL):

a) Only the target namespace of the root element is recognized by the converter.
Note: Target namespaces can be assigned by prefixing an element with a namespace prefix (forming a QName) or declaring a default namespace.

b) There is no validation of leaf elements. Root element can optionally be validated. See the attribute GEN_VALIDATE_ROOT_IN_NS in CodegenProperty.

c) No distinction can be made for elements that differ only by namespace. For example, elements ″q:a″ and ″q1:a″ where q and q1 are bound to different namespaces in the message are treated as just ″a″.


=======================================
2. OUTBOUND CONVERSION:
For outbound conversion (COBOL to XML) the correct qualification prefixes and namespaces are generated based on the schemas for the XML message.

The following restrictions apply:

a) OPTIMIZATION

For optimization purposes, if all the elements of the outbound message are bound to the same
namespace, then the outbound converter qualifies them all implicitly, by using a default namespace.
 
Figure 1 shows an example of an output message where the elements are implicitly qualified:
____________________________________________________________________________
 
<?xml version="1.0" encoding="UTF-8"?>
<LONEPost xmlns="http://www.loneI.com/schemas/loneIInterface"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loneI.com/schemas/loneIInterface LONEI.xsd">
<Company>IBM</Company>
<Voucher_number>002</Voucher_number>
<Transaction_type>001</Transaction_type>
<Delivery_system>POST</Delivery_system>
<Transfer_date>16002007</Transfer_date>
<Posting_date>17152007</Posting_date>
</LONEPost>

Figure 1. Example of Outbound Converter Message Using Implicitly Qualified Elements
___________________________________________________________________________

If the outbound converter did not do this optimization, then the parameters in the output message
would be generated in the format shown in Figure 2:
___________________________________________________________________________
 
<?xml version="1.0" encoding="UTF-8"?>
<cbl:LONEPost xmlns:cbl="http://www.loneI.com/schemas/loneIInterface"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loneI.com/schemas/loneIInterface LONEI.xsd">
<cbl:Company>IBM</cbl:Company>
<cbl:Voucher_number>002</cbl:Voucher_number>
<cbl:Transaction_type>001</cbl:Transaction_type>
<cbl:Delivery_system>POST</cbl:Delivery_system>
<cbl:Transfer_date>16002007</cbl:Transfer_date>
<cbl:Posting_date>17152007</cbl:Posting_date>
<cbl:LONEPost>

Figure 2. Example of Outbound Converter Message Using Explicitly Qualified Elements
___________________________________________________________________________

Note: The contents of the structures in Figure 1 and Figure 2 are equivalent. However Figure 1 is a more efficient use of XML namespaces.

The outbound XML converter uses this optimization whenever possible to reduce the size of XML messages. This optimization has conservation benefits ranging from CPU time to network bandwidth.


b) MIXED elementForm VALUES

The optimization in the use of XML namespaces that is described in the previous section is possible only if the elementForm values (explicit or implicit) are the same for all mapped items.

Figure 3 is an example of an XML Schema with mixed elementForm values:
___________________________________________________________________________
 
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:addr="http://www.address.com/"
targetNamespace="http://www.address.com/"
elementFormDefault="unqualified" attributeFormDefault="unqualified">

<complexType name="USAddress">
<sequence>
<!-- explcit Form="qualified" -->
<element name="name" type="string" form="qualified"/>

<!-- implicit Form="unqualified" -->
<element name="street" type="string"/>
</sequence>
</complexType>
</schema>

Figure 3. Example of XML Schema with Mixed elementForm Values
___________________________________________________________________________


For the schemas with mixed element qualification, the outbound converter generates the namespaces prefixes when required. For the previous schema with mixed element qualification (see Figure 3), the outbound converter generates a message containing the following fragment:

...
<addr:name>addr:name</addr:name> <!-- qualified -->
<street>street</street> <!--unqualified-->
...

[{"Type":"MASTER","Line of Business":{"code":"LOB35","label":"Mainframe SW"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSTRMM","label":"IBM Developer for z\/OS"},"ARM Category":[{"code":"a8m0z00000009N7AAI","label":"IBM Developer for Z\/OS-\u003EWeb Services-\u003EXML Enablement"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Product Synonym

IDz

Document Information

Modified date:
21 November 2023

UID

swg21377103