jbarberan / beanio

Automatically exported from code.google.com/p/beanio
0 stars 0 forks source link

A segment of indeterminate size may not follow another component of indeterminate size #94

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi
Please help as writing ultiple Segment throws error

Sample XML config is
    <stream name="writeStream" format="delimited" strict="true">
        <parser>
            <property name="delimiter" value="|" />
        </parser>
        <record name="shipment" class="com.Shipment" maxLength="unbounded">
            <field name="noOfShipments" type="Integer" />
            <segment name="spsShipmentPart1" class="com.Part1">
                <field name="airbillNbr" type="String" nillable="true" />
            </segment>

            <field name="noOfShipmentContents" type="Integer" />
            <segment name="shipmentContentsPart2"
                class="com.ShipmentContentsPart2"
                collection="list" minOccurs="1" maxOccurs="unbounded">
                <field name="shipmentContents" type="String" nillable="true" />
            </segment>

            <field name="noOfSpecialServices" type="Integer" />
            <segment name="specialServicesPart3"
                class="com.SpecialServicePart3"
                collection="list" minOccurs="0" maxOccurs="unbounded">
                <field name="chrgServCode" type="String" nillable="true" />
                <field name="chrgAmt" type="String" nillable="true" />
            </segment>
        </record>
    </stream>

What version of BeanIO are you using? 
beanio.jar version 2.0.7 and 2.1.0 Both gives same error
What JDK version?
1.6.0.35

Please provide any additional information below.
Appreciate any help

Original issue reported on code.google.com by chetan.a...@gmail.com on 13 Dec 2013 at 10:54

GoogleCodeExporter commented 8 years ago
Please use the forum / google group for questions.

You must use version 2.1.x and set occursRef="[name of field]" on segments 
whose occurrences depend on a preceding field in the same record.

Thanks,
Kevin

Original comment by kevin.s...@gmail.com on 14 Dec 2013 at 7:40

GoogleCodeExporter commented 8 years ago
Thanks Kevin

Appreciate your quick response and tried your suggestions and bingo it works

Original comment by chetan.a...@gmail.com on 15 Dec 2013 at 11:36