@@isPresent element in XML Composer step for optional groups

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

@@isPresent element in XML Composer step for optional groups

Post by vivek »

Hi,
I have to create an XML based on the xsd supplied by the end client.
its looks something like the below format.

Code: Select all

<xs:element name="HealthForm">
 <xs:complexT ype>
  <xs:sequence>
   <xs:element name="Form-ID"
   <xs:element name="Insurance-Type"
   <xs:element name="Health-History" >
     <xs:complexType>
       <xs:sequence>
         <xs:element name="Existing ailment" type="xs:string" minOccurs="0"/>
	 <xs:element name="Number of insurance claims" type="xs:in t" minOccurs="0" />
       </xs:sequence>
    </xs:complexType>
   </xs:element>
   </xs:sequence>
 </xs:complexType>
</xs:element>
Form-Id and Insurance-Type fields are mandatory but the 'health-History" group is optional since all of its child elements are of min occurrence=0.

when I imported xsd supplied from the end client in the assembly editor, there is a "@@ispresent" element appearing under the 'health-history' element, which means data stage also identified this 'Health history' group as an optional element.

however, when I passed null values for this group, the outpt XML file still displays this group. the results are displayed with "xsi:nil="true"/" for next to the column names.

Can some one please help me configure, this xml composer job to drop this optional group in the output, whenever the corresponding columns have no data?
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Post by vivek »

I found the solution.
I check marked the 'Omit Null Elements' option in the format tab of XML Composer and ,now, I don't see the empty elements or associated groups anymore.

:)
Post Reply