Hi i am trying to map an OTA_AirBookRQ into a java structure. My
Structure consists of a class called Leg with two attributes origin
country code and destination country code. Class Flight extends Leg.

The data lives in this section of the xml

<ns3:FlightSegment
ArrivalDateTime="2009-03-16T10:45:00.000Z"
DepartureDateTime="2009-03-16T07:10:00.000Z" E_TicketEligibility="Y"
FlightNumber="2722" FlightType="SH" ResBookDesigCode="O">
    <ns3:DepartureAirport CountryCode="GB" LocationCode="LGW" Terminal="N"/>
    <ns3:ArrivalAirport CountryCode="GB" LocationCode="ALC" Terminal=""/>
    <ns3:OperatingAirline Code="BA" CompanyShortName="British Airways"/>
    <ns3:MarketingAirline Code="BA" CompanyShortName="British Airways"/>
</ns3:FlightSegment>

Ok so its the CountryCode attribute in Departure / arrival airport i am after 
here.

So how do i get the <structure map-as="Leg"/> to conform to an attribute?

Everytime i run the unmarshaller it falls over with this

org.jibx.runtime.JiBXException:
Expected "DepartureAirport" start tag, found
"{http://www.opentravel.org/OTA/2003/05}DepartureAirport"; end tag (line
10, col 74)
    at 
org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:652)
    at 
org.jibx.runtime.impl.UnmarshallingContext.parseToStartTag(UnmarshallingContext.java:670)
    at com.ian.Leg.JiBX_AirBookBinding_unmarshal_1_0(Leg.java)
    at com.ian.Flight.JiBX_AirBookBinding_unmarshal_2_1(Flight.java)
    at com.ian.JiBX_AirBookBindingFlight_access.unmarshal()
    at 
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2762)
    at 
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2905)
    at com.ian.Harness.main(Harness.java:20)


This is the binding file, which is clearly wrong

<binding>
<mapping class="com.ian.Leg" abstract="true">
        <structure name="DepartureAirport" value-style="attribute">
            <value name="CountryCode" field="originCountryCode"/>
        </structure>
        <structure name="ArrivalAirport" value-style="attribute">
            <value name="CountryCode" field="destinationCountryCode"/>
        </structure>
</mapping>

<mapping name="OTA_AirBookRQ" class="com.ian.Flight" extends="com.ian.Leg">
    <namespace uri="http://www.opentravel.org/OTA/2003/05"; default="elements"/>
    
    <value name="TransactionIdentifier" style="attribute" field="transCode"/>
    <structure name="FlightSegment" value-style="attribute">
        <value name="FlightNumber" field="flightNo"/>
        <value name="E_TicketEligibility" field="eTicketEligible"/>
        <value name="FlightType" field="flightType"/>
        <value name="FlightNumber" field="flightNo"/>
        
        <structure name="DepartureAirport" value-style="attribute">
            <value name="LocationCode" field="depAirPortCode"/>
            <structure map-as="com.ian.Leg"/>
        </structure>
        
        <structure name="ArrivalAirport" value-style="attribute">
            <value name="LocationCode" field="arrAirportCode"/>
        </structure>
        
        <structure name="OperatingAirline" value-style="attribute">
            <value name="Code" field="carrierCode"/>
            <value name="CompanyShortName" field="carrierName"/>
        </structure>
        
        <structure name="MarketingAirline"/>
    </structure>
    
    
</mapping>
</binding>


Can anyone please help this is urgent.

Thanks in advance
_________________________________________________________________
View your other email accounts from your Hotmail inbox. Add them now.
http://clk.atdmt.com/UKM/go/167688463/direct/01/
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to