Sorry for double posting this on top the forum - sort of desperate here....
====
Hi,
I should be able to unmarshal a sub-element of XML using the unmarshal
method, right?
Here's my problem: I am using the latest 2.1 impl.
I bound my XSDs into jaxb classes
mypack/BoundBean1.java
mypack/BoundBean2.java
....
Then in my client class, I tried to unmarshal a sub-Element of XML per
BoundBean2.xsd like this:
....
(Bean2.SomeElement) jc.createUnmarshaller().unmarshal(new
StringReader(xmlElementStringOfBoundBean2));
....
I got an exception like this:
=======
....
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"", local:"Request"). Expected elements are
<{}AirlineCode>,<{}AmadeusCloseSessionRQ>,<{}AmadeusCloseSessionRS>,<{}AmadeusOpenSessionRQ>,<{}AmadeusOpenSessionRS>,<{}ApolloCloseSessionRQ>,<{}ApolloCloseSessionRS>,<{}ApolloOpenSessionRQ>,<{}ApolloOpenSessionRS>,<{}ApolloRESAvailabilityRQ>,<{}ApolloRESAvailabilityRS>,<{}ArrayItem>,<{}BagDestination>,<{}BagTagAirlineCarrier>,<{}BagTagDigit>,<{}BagTagNumber>,<{}BusinessClassCabinPaxCount>,<{}ConsecutiveNumberedBags>,<{}Coupon>,<{}DM_NAMES>,<{}DisplayTime>,<{}DownLineArrivalGate>,<{}DownLineCarrier>,<{}DownLineDestStn>,<{}DownLineETD>,<{}DownLineFlightNumber>,<{}DownLineInternationalBookingCode>,<{}DownLineInternationalCarrier>,<{}DownLineInternationalConnectionDestinationStn>,<{}DownLineInternationalConnectionPaxStatus>,<{}DownLineInternationalFlightNumber>,<{}DownLinePaxCount>,<{}EconomyClassCabinPaxCount>,<{}FareBasisCode>,<{}FirstClassCabinPaxCount>,<{}FlightDate>,<{}FlightNumber>,<{}FlightStatus>,<{}FrequentFlyerNumber>,<{}FrequentFlyerTierLevel>,<{}INDEX>,<{}InfantStatus>,<{}InfantTag>,<{}InvoluntaryUpgradeIndicator>,<{}ListTitle>,<{}NativeCloseSession>,<{}NativeOpenSessionPassword>,<{}NativeOpenSessionUserId>,<{}NoShowReason>,<{}NumberOfBags>,<{}OffLoadReason>,<{}OriginAirportCode>,<{}PaxACIName>,<{}PaxAPISAgent>,<{}PaxAPISCollectionMedia>,<{}PaxAPISFirstName>,<{}PaxAPISLastName>,<{}PaxAPISNationality>,<{}PaxAPISStatus>,<{}PaxAPISod>,<{}PaxBoardingStatus>,<{}PaxBookingCode>,<{}PaxCabinClass>,<{}PaxCheckInStatus>,<{}PaxCheckedBags>,<{}PaxCommentIndicator>,<{}PaxCommentText>,<{}PaxDOTAgent>,<{}PaxDOTComment>,<{}PaxDOTNationality>,<{}PaxDestination>,<{}PaxDotFirstName>,<{}PaxDotLastName>,<{}PaxDownlineConnectionIndicator>,<{}PaxETKTtype>,<{}PaxFirstNameInitial>,<{}PaxGroupCode>,<{}PaxGroupNumberInParty>,<{}PaxInboundCarrier>,<{}PaxInboundCountry>,<{}PaxInboundDownLineCarrier>,<{}PaxInboundFlightNumber>,<{}PaxLastName>,<{}PaxMPImember>,<{}PaxOnDepartureMgtList>,<{}PaxSeatNumber>,<{}PaxType>,<{}PaxUpgradedOrAwardTkt>,<{}PaxUplineStation>,<{}PaxVISACollectionMedia>,<{}PaxWithPreAssignedSeat>,<{}RESAvailabilityRQ>,<{}RESAvailabilityRS>,<{}REST>,<{}RecordLocator>,<{}RunwayNativeCloseSessionRS>,<{}RunwayNativeCommandRQ>,<{}RunwayNativeCommandRS>,<{}RunwayNativeOpenSessionPasswordRS>,<{}RunwayNativeOpenSessionUserIdRS>,<{}RunwayOutput>,<{}RunwayPassengerListRS>,<{}SDMSOF>,<{}SDMSON>,<{}SSRCode>,<{}SdmSofRunwayOutput>,<{}ServiceChargeAmount>,<{}ServiceChargeCurrencyCode>,<{}ServiceChargeStatus>,<{}ServiceChargeText>,<{}TicketNumber>,<{}UpLineCarrier>,<{}UpLineDepartureGate>,<{}UpLineDestStn>,<{}UpLineETD>,<{}UpLineFlightNumber>,<{}UpLineFlightStatus>,<{}UpLineInternationalCarrier>,<{}UpLineInternationalCheckinClass>,<{}UpLineInternationalConnectionDestinationStn>,<{}UpLineInternationalConnectionPaxStatus>,<{}UpLineInternationalFlightNumber>,<{}UpLinePaxCount>,<{}UpgradeType>,<{}VISAAgent>,<{}fieldOD>
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)
....
=======
where the "expected elements" listed are the root elements of my JAXB
bound beans; and the "unexpected" <Request> is the a sub-element of
XML for one of the "expected" root elements.
What am I doing wrong here?
Thanks very much for your help!!!