ElementFormDefault definition
The elementFormDefault is a schema property that defines how the types would be qualified for a given schema definition. For any schema created in IBM® Integration
Designer, by default this property is not specified, and the property is treated as unqualified.
When you convert Business Objects (BOs) to XML using
the BOXMLSerializer API, you might need to qualify the local elements
in the XML, in addition to the root element. For example, for the
following XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="uri:my_namespace">
<xs:element name="myDoc">
<xs:complexType>
<xs:sequence>
<xs:element name="subnode" type="xs:string" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>The corresponding XML may need to
be as follows:
<ns0:mydoc xmlns:ns0="uri:my-namespace">
<ns0:subnode/>
</ns0:mydoc> However, instead, the following
XML is what is generated: <ns0:mydoc xmlns:ns0="uri:my-namespace">
<subnode/>
</ns0:mydoc> Notice that the entry for the property subnode does not include the qualifier ns0. Depending on the scenario, unqualified elements might be set as
null in the resulting business object. To achieve the correct qualified
behavior of schema artifacts, set the elementFormDefault attribute in the schema or business object as follows:
<xs:schema xmlns:xs="http:// www.w3.org/2001/XMLSchema" targetNamespace="uri:my-namespace" elementFormDefault="qualified"> Tip: To add the elementFormDefault attribute on a business
object, you need to edit the XSD. Right click the business object
in the Business Integration view and select Open with >
XML Editor.
Alternatively, the namespace
qualification mechanism can also be controlled on a declaration-by-declaration
basis by using the form attribute: <xs:element name="subnode" maxOccurs="1" form="qualified"/>
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15