Z,
Quick fix: delete the xmlns="" from the PricedItinerary element.
The explanation of the problem:
XmlBeans sees this as:
<org.opentravel.www.ORA_AirLowFareSearchRS>
<org.opentravel.www.PricedItineraries>
<noNamespace.PricedItinerary ...>
As your sample is below, PricedItinerary is in the empty namespace (so is
mapped by XmlBeans to the noNamespace package) and the method you are calling
is:
org.opentravel.www.PricedItinerary[]
PricedItineraries.getPricedItineraryArray();
But the array is populated with noNamespace.PricedItinerary objects.
So the call correctly returns an empty array.
However, the call:
resultElement.getElementsByTagName("PricedItinerary").getLength();
finds the noNamespace.PricedItinerary elements/objects, which do exist as valid nodes.
I hope that helps clear up your confusion.
Dave.
Z Ellmy wrote:
I'm pretty sure the XML is formed the way that I expect. Below is a
sample from my test:
<OTA_AirLowFareSearchRS xmlns="http://www.opentravel.org/OTA/2003/05">
<Success />
<PricedItineraries>
<PricedItinerary SequenceNumber="1" xmlns="">
<AirItinerary>
<OriginDestinationOptions>
<OriginDestinationOption>
<FlightSegment
ArrivalDateTime="2005-08-13T13:55:00"
DepartureDateTime="2005-08-13T12:35:00"
FlightNumber="8023"
ResBookDesigCode="Q"
StopQuantity="0">
<DepartureAirport
LocationCode="IAD" />
<ArrivalAirport
LocationCode="STL" />
<Equipment
AirEquipType="ER4" />
<MarketingAirline
Code="UA" />
</FlightSegment>
<FlightSegment
ArrivalDateTime="2005-08-13T16:16:00"
DepartureDateTime="2005-08-13T15:00:00"
FlightNumber="5549"
ResBookDesigCode="Q"
StopQuantity="0">
<DepartureAirport
LocationCode="STL" />
<ArrivalAirport
LocationCode="LIT" />
<Equipment
AirEquipType="ER4" />
<MarketingAirline
Code="AA" />
</FlightSegment>
</OriginDestinationOption>
</OriginDestinationOptions>
</AirItinerary>
<AirItineraryPricingInfo>
<ItinTotalFare>
<BaseFare Amount="239.07" />
<Taxes>
<Tax Amount="38.33" TaxCode="TTL"
/>
</Taxes>
<TotalFare Amount="277.40" />
</ItinTotalFare>
<PTC_FareBreakdown>
<PassengerTypeQuantity Code="ADT"
Quantity="1" />
<FareBasisCode>Q0NX</FareBasisCode>
<FareBasisCode>QA7QDN</FareBasisCode>
<PassengerFare>
<BaseFare Amount="239.07" />
<Taxes>
<Tax Amount="38.33"
TaxCode="TTL" />
</Taxes>
<TotalFare Amount="277.40" />
</PassengerFare>
</PTC_FareBreakdown>
<FareRuleInfo>
<FareReference>Q0NX</FareReference>
<FilingAirline Code="ZZ" />
<DepartureAirport LocationCode="IAD" />
<ArrivalAirport LocationCode="LIT" />
</FareRuleInfo>
</AirItineraryPricingInfo>
</PricedItinerary>
</PricedItineraries>
</OTA_AirLowFareSearchRS>
On 7/25/05, Mark Lewis <[EMAIL PROTECTED]> wrote:
Can you include the XML you are running against?
My first guess is that the PricedItinerary items are actually located
somewhere else in the XML document than where you are looking-- the
getElementsByTagName() method searches through all child tags, children
of child tags, children of children of ... you get the idea. The
getPricedItineraries() method returns only the children of the immediate
PricedItineraries tag. Maybe the XML isn't formed the way you expect?
On Mon, 2005-07-25 at 16:10 -0400, Z Ellmy wrote:
I have a situation where I'm getting empty arrays where I know that
the nodes actually exist. Below is a snippet of what I'm doing:
OTAAirLowFareSearchRSDocument rsDoc = OTAAirLowFareSearchRSDocument.Factory
.parse(resultElement);
int nodeListLength =
resultElement.getElementsByTagName("PricedItinerary").getLength();
PricedItineraryType[] t =
rsDoc.getOTAAirLowFareSearchRS().getPricedItineraries().getPricedItineraryArray();
PricedItinerariesType typ =
rsDoc.getOTAAirLowFareSearchRS().getPricedItineraries();
int sizeOfPricedItineraryArray = typ.sizeOfPricedItineraryArray();
When this executes I see:
nodeListLength = 9
t.length = 0
sizeOfPricedItineraryArray = 0
I see this behavior with both 1.0.4 and 2.0.0. Any ideas?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]