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

Technote (troubleshooting)


This document applies only to the following language version(s):

Language Independent

Problem(Abstract)

This technote documents several restrictions in the processing of namespaces and qualified XML elements in the XML-COBOL data conversion programs that are generated for single-service projects.

Resolving the problem

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-->
...

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational Developer for System z

Software version:

7.1.0

Operating system(s):

Windows

Software edition:

All Editions

Reference #:

1377103

Modified date:

2013-02-08

Translate my page

Machine Translation

Content navigation