IBM Sterling Transformation Extender

 View Only
Expand all | Collapse all

Empty property not working for Group Type (please help)

  • 1.  Empty property not working for Group Type (please help)

    Posted Mon December 30, 2019 01:24 PM

    Originally posted by: Dary_Legen


    Hi guys,

     

    I am working on transforming a file from X12 (input) to XML(output). My output is required to have self closing XML tags (i.e. <element/>) when associated XML element is not evaluated. After doing dozens of research I found out that self-closing XML tags are not possible to output when using XML schema as the type tree. So, I instead, created a type tree by importing XML schema using classic validation. Using Empty property under Type Syntax, I was able to generate the self closing XML tags. However, I am running into a issue when XML tag is of complex type (when it has sub elements inside it - see below) and not of simple type.

    ...

    <another_element></another_element>

    <main_element>

     <element_1></element_1>

     <element_2></element_2>

     ...

    </main_element> 

    Currently, it is outputting <main_element></main_element> when its subelements are evaluated to NONE. I want it to output with self closing tag like so <main_element/>. 

    Please note: that it is outputting self closing XML tags when element is a simple type (i.e. <another_element/>) but is not doing it for elements that have sub_elements. So, can anyone knows a solution or a workaround this issue? Much appreciated. 

     

     

    I am using the following edition of ITX:

    Version: 9.0.0.3
    Build id: 21 


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 2.  Re: Empty property not working for Group Type (please help)

    Posted Tue December 31, 2019 03:42 AM

    Originally posted by: PaulBrett


    Have you set the min range of the sub elements to 0?  Perhaps it is stuck at 1?

    Thank you.

    Paul

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 3.  Re: Empty property not working for Group Type (please help)

    Posted Tue December 31, 2019 11:25 AM

    Originally posted by: Dary_Legen


    Hi Paul,

    The subelements all have min range of 0. I forgot to include another sub element under main element in my original post. This is the snippet of correct version of my XML schema structure with ranges:

    ...

    <another_element minOccurs="1" ></another_element>

    <main_element minOccurs="1">

    <sub_element minOccurs="0" maxOccurs="unbounded"

    <element_1 minOccurs="0"></element_1>

    <element_2 minOccurs="0"></element_2>

     ...

    </sub_element>

    </main_element>

     

    Thanks


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 4.  Re: Empty property not working for Group Type (please help)

    Posted Tue December 31, 2019 11:38 AM

    Originally posted by: Dary_Legen


    Fyi, the reason I am setting another_element and main_element minOccurs to 1 is because I want to see self-closing tag for those elements. I noticed that only when minOccurs is set to 1 will the Empty property work. 


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender