title: Beanio stream to Process list of inner elements in xml flat file
body: <p>I am new to beanio. Can some one please help me with this. I am trying to process the input file, which looks like below, where existence of Item elements inside Data element is numerous:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="windows-1252"?&gt;
  &lt;ROOT xmlns="http://www.post.ch/schemas/dfu/2006/20/Report11"&gt;
  &lt;Sender&gt;
  &lt;Provider&gt;
  &lt;Data&gt;
  &lt;Item SendingID="314" ItemID="996099999902916713" IdentCode="996099999902916713" AdrZ1="Meier" AdrZ2="" AdrZ3="" AdrZ4="Dorfweg" AdrZ5="6" AdrZ6="4117" AdrZ7="Burg im Leimental" DFUTransferDateTime="2019-07-18T13:24:56" ItemWeight="480" EventDateTime="2019-07-22T04:13:59" EventNumber="9209" EventDescription="Ordre voisin souhaité" EventNumber_Sub="" Event_SubDescription="" EventZipCode="303001" PrZl="SAZU" DeliveredTo="" TrackAndTrace="https://service.post.ch/EasyTrack/secure/GKDirectSearch.do?formattedParcelCodes=996099999902916713;&amp;amp;lang=fr" Status="31" StatusDescription="Prêt pour la distribution" ExpectedDeliveryDate="27.07.19" DeadlinePickup="" /&gt;
  &lt;Item SendingID="313" ItemID="996099999902916585" IdentCode="996099999902916585" AdrZ1="Müllerer" AdrZ2="" AdrZ3="" AdrZ4="Gärischstrasse" AdrZ5="27" AdrZ6="4512" AdrZ7="Bellach" DFUTransferDateTime="2019-07-17T13:51:23" ItemWeight="1080" EventDateTime="2019-07-22T07:32:59" EventNumber="4000" EventDescription="Distribué" EventNumber_Sub="" Event_SubDescription="" EventZipCode="462070" PrZl="" DeliveredTo=" " TrackAndTrace="https://service.post.ch/EasyTrack/secure/GKDirectSearch.do?formattedParcelCodes=996099999902916585;&amp;amp;lang=fr" Status="61" StatusDescription="Distribué" ExpectedDeliveryDate="22.07.19" DeadlinePickup="" /&gt;
  &lt;/Data&gt;
  &lt;/Provider&gt;
  &lt;/Sender&gt;
  &lt;/ROOT&gt;
  </code></pre>
  
  <p>My stream in beanio xml looks like below:</p>
  
  <pre><code>&lt;stream name="swisspost" format="xml" xmlName="ROOT" xmlNamespace="http://www.post.ch/schemas/dfu/2006/20/Report11"&gt;
      &lt;record name="shippingData" xmlName="Sender" class="com.test.eventproc.carrier.data.ShippingDataDO"&gt;
          &lt;property name="carrierMoniker" value="swisspost"/&gt;
          &lt;segment name="Provider"&gt;
              &lt;segment name="Data"&gt;
                  &lt;segment name="Item"&gt;
                      &lt;field name="trackingNumber" xmlName="IdentCode" xmlType="attribute"&gt;&lt;/field&gt;
                  &lt;/segment&gt;
                  &lt;segment name="shippingDetail" xmlName="Item" xmlType="element" class="com.test.eventproc.carrier.data.ShippingDetailDO"&gt;
                      &lt;field name="trackingNumber" xmlName="IdentCode" xmlType="attribute"&gt;&lt;/field&gt;
                      &lt;field name="eventCode" xmlName="EventNumber" xmlType="attribute"&gt;&lt;/field&gt;
                      &lt;field name="eventDate" xmlName="EventDateTime" xmlType="attribute"&gt;&lt;/field&gt;
                      &lt;field name="eventName" xmlName="EventDescription" xmlType="attribute"&gt;&lt;/field&gt;
                  &lt;/segment&gt;
              &lt;/segment&gt;
          &lt;/segment&gt;
      &lt;/record&gt;
  &lt;/stream&gt;
  </code></pre>
  
  <p>As per my above stream only first Item element value is processed and the program exits. Is there a way, i can process all Item elements? Below is the code, i am using to populate BeanReader object:</p>
  
  <pre><code>StreamFactory factory = StreamFactory.newInstance();
              factory.loadResource("mapping.xml");//mapping.xml is my bean-io mapping file.
  
              File originalFile = convert(file);//file is the input xml flat file
              FileInputStream inputStream = new FileInputStream(originalFile);
              BeanReader reader = factory.createReader(streamName, new InputStreamReader(inputStream));
              Object record;
              List&lt;ShippingDataDO&gt; shippingDataDOs = new ArrayList&lt;ShippingDataDO&gt;();
  
              while ((record = reader.read()) != null) {
                  ShippingDataDO shippingDataDO = (ShippingDataDO) record;
                  shippingDataDOs.add(shippingDataDO);
              }
  </code></pre>
  
  <p>I tried mapping xml something like below. But, now no records are retrieved from the input flat xml file.</p>
  
  <pre><code>&lt;stream name="swisspost" format="xml" xmlName="ROOT" xmlNamespace="http://www.post.ch/schemas/dfu/2006/20/Report11"&gt;
          &lt;record name="Sender"&gt;
              &lt;segment name="Provider"&gt;
                  &lt;segment name="Data"&gt;
                      &lt;segment name="shippingData" xmlName="Item" maxOccurs="unbounded" collection="list" class="com.narvar.carrier.utilities.pojo.ShippingDataDO"&gt;
                          &lt;property name="carrierMoniker" value="swisspost"/&gt;
                          &lt;field name="trackingNumber" xmlName="IdentCode" xmlType="attribute"&gt;&lt;/field&gt;
                      &lt;/segment&gt;
                      &lt;segment name="shippingDetail" xmlName="Item" xmlType="element" maxOccurs="unbounded" class="com.narvar.carrier.utilities.pojo.ShippingDetailDO" collection="list"&gt;
                          &lt;field name="trackingNumber" xmlName="IdentCode" xmlType="attribute"&gt;&lt;/field&gt;
                          &lt;field name="eventCode" xmlName="EventNumber" xmlType="attribute"&gt;&lt;/field&gt;
                          &lt;field name="eventDate" xmlName="EventDateTime" xmlType="attribute"&gt;&lt;/field&gt;
                          &lt;field name="eventName" xmlName="EventDescription" xmlType="attribute"&gt;&lt;/field&gt;
                      &lt;/segment&gt;
                  &lt;/segment&gt;
              &lt;/segment&gt;
          &lt;/record&gt;
      &lt;/stream&gt;
  </code></pre>