Keith -- I'm resending these files with the hope that they'll show up as attachments rather than plain text.
Rgs,
Zeb
On Tue, 11 Mar 2003, Keith Visco wrote:
:
:Zeb,
:
:Can you attach the full schema, so we can see what the groups that are
:being referenced look like.
:
:Thanks,
:
:--Keith
:
:"Aurangzeb M. Agha" wrote:
:>
:> I asked this before but fear that my message was too long.
:>
:> I'm using castor 0.9.4.3-xml.jar.
:>
:> Here's a summary of my problem:
:>
:> I have a valid XML which, when unmarshalled, is getting validated against
:> the wrong definition.
:>
:> When unmarshalling NexRes/response/viewReservationResponse, I get the
:> following error:
:>
:> ValidationException: bookingStatus is a required field.;
:> - location of error: XPATH: NexRes/response/bookReservationResponse
:>
:> My XSD contains:
:>
:> <...NexRes...>
:> ...
:> <xsd:element name="response">
:> <xsd:complexType>
:> <xsd:sequence>
:> ...
:> <xsd:group ref="bookReservationResponse" minOccurs="0"/>
:> <xsd:group ref="viewReservationResponse" minOccurs="0"/>
:> ...
:> </xsd:sequence>
:> </xsd:complexType>
:> </xsd:element>
:>
:> I've made sure that these two elements appear in the XSD in the same order
:> as they are shown above. If I switch them (in the XSD shown above), then
:> the problem flips, and though I can unmarshall
:> NexRes/response/viewReservationResponse without any problem, I get a
:> similiar exception when trying to unmarshall bookReservationResponse:
:>
:> ValidationException: bookingStatus is a required field.;
:> - location of error: XPATH: NexRes/response/viewReservationResponse
:>
:> I've tried to use xsd:all instead of xsd:sequence, but that makes no
:> difference either.
:>
:> I'd very much appreciate some help.
:>
:> Sincerely,
:> Zeb
:>
:> PS -- The original message is below.
:>
:> ---------- Forwarded message ----------
:> Date: Tue, 11 Mar 2003 05:41:28 -0800 (PST)
:> From: Aurangzeb M. Agha <[EMAIL PROTECTED]>
:> Reply-To: [EMAIL PROTECTED]
:> To: [EMAIL PROTECTED]
:> Subject: [castor-dev] Problem with order of ref elements in sequence
:>
:> I'm having a big problem with a large schema where the order of reference
:> elements in a sequence seem to conflict when I try to unmarshall an
:> object.
:>
:> I have two elements which seem to be at the root of the problem:
:>
:> <xsd:element name="request">
:> <xsd:complexType>
:> <xsd:sequence>
:> <xsd:group ref="propertySearch" minOccurs="0"/>
:> <xsd:group ref="propertyInformationRequest" minOccurs="0"/>
:> <xsd:group ref="propertyAvailabilityRequest" minOccurs="0"/>
:> <xsd:group ref="bookReservation" minOccurs="0"/>
:> <xsd:group ref="cancelReservation" minOccurs="0"/>
:> <xsd:group ref="viewReservation" minOccurs="0"/>
:> <xsd:group ref="rateRulesRequest" minOccurs="0"/>
:> </xsd:sequence>
:> </xsd:complexType>
:> </xsd:element>
:>
:> <xsd:element name="response">
:> <xsd:complexType>
:> <xsd:sequence>
:> <xsd:group ref="propertyInformationResponse" minOccurs="0"/>
:> <xsd:group ref="propertyAvailabilityResponse" minOccurs="0"/>
:> <xsd:group ref="bookReservationResponse" minOccurs="0"/>
:> <xsd:group ref="cancelReservationResponse" minOccurs="0" />
:> <xsd:group ref="viewReservationResponse" minOccurs="0"/>
:> <xsd:group ref="rateRulesResponse" minOccurs="0"/>
:> </xsd:sequence>
:> </xsd:complexType>
:> </xsd:element>
:>
:> The order of the elements in the "request" element is causing a problem
:> for me no matter how I move the elements around in the XSD. Using what I
:> have above, if I try to unmarshall a ViewReservation object (which looks
:> like this):
:>
:> <NexRes product="Hotel">
:> <response status="failure" type="ViewReservation"
:> timestamp="20030311081435">
:> <errors>
:> <error number="0">
:> <message>We could not find reservation in our
:> records. Please
:> adjust your information and try again.</message>
:> <code>H105</code>
:> </error>
:> </errors>
:> </response>
:> <session>
:> <language>ENG</language>
:> <id></id>
:> <affiliate>
:> <overrides></overrides>
:> <id>##########</id>
:> <subAffiliateId></subAffiliateId>
:> </affiliate>
:> <timestamp>20030311081435</timestamp>
:> </session>
:> <request type="ViewReservation">
:> <customer>
:> <lastName>######</lastName>
:> <firstName>######</firstName>
:> <clientId></clientId>
:> </customer>
:> <confirmationNumber>######</confirmationNumber>
:> </request>
:> </NexRes>
:>
:> I get the following error:
:>
:> ValidationException: bookingStatus is a required field.;
:> - location of error: XPATH: NexRes/response/bookReservationResponse
:>
:> The problem is that 'bookingStatus' is not an element in
:> ViewReservationResponse;
:> but it is in BookReservationResponse.
:>
:> If I either comment out bookReservation:
:>
:> <xsd:element name="request">
:> <xsd:complexType>
:> <xsd:sequence>
:> <xsd:group ref="propertySearch" minOccurs="0"/>
:> <xsd:group ref="propertyInformationRequest" minOccurs="0"/>
:> <xsd:group ref="propertyAvailabilityRequest" minOccurs="0"/>
:> <!--xsd:group ref="bookReservation" minOccurs="0"/-->
:> <xsd:group ref="cancelReservation" minOccurs="0"/>
:> <xsd:group ref="viewReservation" minOccurs="0"/>
:> <xsd:group ref="rateRulesRequest" minOccurs="0"/>
:> </xsd:sequence>
:> </xsd:complexType>
:> </xsd:element>
:>
:> or change the order of the elements:
:>
:> <xsd:element name="request">
:> <xsd:complexType>
:> <xsd:sequence>
:> <xsd:group ref="cancelReservation" minOccurs="0"/>
:> <xsd:group ref="propertySearch" minOccurs="0"/>
:> <xsd:group ref="propertyInformationRequest" minOccurs="0"/>
:> <xsd:group ref="propertyAvailabilityRequest" minOccurs="0"/>
:> <xsd:group ref="bookReservation" minOccurs="0"/>
:> <xsd:group ref="viewReservation" minOccurs="0"/>
:> <xsd:group ref="rateRulesRequest" minOccurs="0"/>
:> </xsd:sequence>
:> </xsd:complexType>
:> </xsd:element>
:>
:> This problem goes away, but then I have a problem when I try to unmarshall
:> the BookReservation element.
:>
:> There seems to be some mix up in the order of elements and the sequence
:> in which they appear in the XSD file, but I can't figure out what it is,
:> or
:> how to define it. Is there some sort of schema validator out there that
:> I can use that will validate the sequence of elements in my XSD?
:>
:> I'd really appreciate some help, and can send the entire XSD file if you
:> can help.
:>
:> Sincerely,
:> Zeb
:>
:> -----------------------------------------------------------
:> If you wish to unsubscribe from this mailing, send mail to
:> [EMAIL PROTECTED] with a subject of:
:> unsubscribe castor-dev
:>
:> -----------------------------------------------------------
:> If you wish to unsubscribe from this mailing, send mail to
:> [EMAIL PROTECTED] with a subject of:
:> unsubscribe castor-dev
:
:-----------------------------------------------------------
:If you wish to unsubscribe from this mailing, send mail to
:[EMAIL PROTECTED] with a subject of:
: unsubscribe castor-dev
:
--
Aurangzeb M. Agha | Email : [EMAIL PROTECTED]
| Home : +3 210 8959.558
34 Nafsika St. | Direct: +3 210 8995.875
Voula 16673 | Mobile: TBD
Greece | e-Fax : 978 246.0770
| PGP id: <coming soon>
"Those who would give up essential liberty to purchase a little
temporary safety deserve neither liberty nor safety."
- Benjamin Franklin
nextRes.tgz
Description: GNU Zip compressed data
bindings.tgz
Description: GNU Zip compressed data
