Results 1 to 5 of 5
  1. #1
    seethalrd is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default JAXB not generating all classes

    Hi all,
    I am new to Jaxb.I am findig issues in generating classes with Jaxb's xjc command.It is working fine for some of the XSDs.But for some of the xsd the 'type' attribute is not working.
    Below are the schemas I am using.

    OTA_HotelRateAmountNotifRS.xsd

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="http://www.opentravel.org/OTA/2003/05" elementFormDefault="qualified" version="1.005" id="OTA2006A" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.opentravel.org/OTA/2003/05">
    <xs:include schemaLocation="OTA_CommonTypes.xsd"/>
    <xs:annotation>
    <xs:documentation xml:lang="en">
    All Schema files in the OTA specification are made available according to the terms defined by the OTA License Agreement at http://www.opentravel.org/ota_downloads_form.cfm
    </xs:documentation>
    </xs:annotation>
    <xs:element name="OTA_HotelRateAmountNotifRS" type="MessageAcknowledgementType">
    <xs:annotation>
    <xs:documentation xml:lang="en">The OTA_HotelRateAmountNotifRS is the message used to indicate the status of processing the OTA_HotelRateAmountNotifRQ message.
    </xs:documentation>
    </xs:annotation>
    </xs:element>
    </xs:schema>

    OTA_CommonTypes.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.006" id="OTA2003A2006A">

    <xs:complexType name="MessageAcknowledgementType">
    <xs:sequence>
    <xs:choice>
    <xs:sequence>
    <xs:element name="Success" type="SuccessType">
    <xs:annotation>
    <xs:documentation xml:lang="en">The presence of the empty Success element explicitly indicates that the OTA versioned message succeeded. </xs:documentation>
    </xs:annotation>
    </xs:element>
    <xs:element name="Warnings" type="WarningsType" minOccurs="0">
    <xs:annotation>
    <xs:documentation xml:lang="en">Used in conjunction with the Success element to define one or more business errors.
    </xs:documentation>
    </xs:annotation>
    </xs:element>
    </xs:sequence>
    <xs:element name="Errors" type="ErrorsType">
    <xs:annotation>
    <xs:documentation xml:lang="en">Errors is returned if the request was unable to be processed.
    </xs:documentation>
    </xs:annotation>
    </xs:element>
    </xs:choice>
    <xs:element name="UniqueID" type="UniqueID_Type" minOccurs="0">
    <xs:annotation>
    <xs:documentation xml:lang="en">May be used to return the unique id from the request message.
    </xs:documentation>
    </xs:annotation>
    </xs:element>
    <xs:element ref="TPA_Extensions" minOccurs="0"/>
    </xs:sequence>
    <xs:attributeGroup ref="OTA_PayloadStdAttributes"/>
    </xs:complexType>
    </xs:schema>

    When I try to build classes usig JAXB,the class -OTA_HotelRateAmountNotifRS is not getting created.The problem is that the attribute type -"MessageAcknowledgementType" which is written in the "OTA_CommonTypes.xsd",is not referrable from the above xsd.But if I paste the above complexType-"MessageAcknowledgementType" written in the xsd-"OTA_CommonTypes.xsd",to the OTA_HotelRateAmountNotifRS.xsd,the calass gets created.But I have many such xsd's and I find it difficlut to paste all the reffered types ,when ever I need.So can anyone help me out to know Why the type attribute is not taken properly by Jaxb?I am using the JAXB that is coming with JWSDP 2.0 and JDK 1.6?Please help me out.......

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Why is it not referrable?
    I thought that xsd:include would pull the CommonTypes xsd in?

    You don't want to be copying types into the xsds.

    Oh, and OTA? Aaaaaarrrrggghhh!

    ...that's better...:)

  3. #3
    seethalrd is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default

    Thanks for the response.I too wanted it to work just with the type attribute.But it isn't working.ie y I tried copying and pasting the type.But it is not a good workaround.I have many xsd's like that.So it is not possible to copy paste all types.Please help me with ur suggestions.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Is it just the CommonTypes xsd that's causing the problem?
    Is it causing a problem on all xsds in which it is included?

  5. #5
    seethalrd is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default

    Actually if we are referring a type from an element which contain only an annotation,it is n't working.ie
    <xs:element name="OTA_HotelRateAmountNotifRS" type="MessageAcknowledgementType">
    <xs:annotation>
    <xs:documentation xml:lang="en">The OTA_HotelRateAmountNotifRS is the message used to indicate the status of processing the OTA_HotelRateAmountNotifRQ message.
    </xs:documentation>
    </xs:annotation>
    </xs:element>

    Here there is only <xs:annotation> within the <xs:element> tag.In this case the type attribute is not working.But look the next case.

    <xs:sequence>
    <xs:element name="POS" type="POS_Type" minOccurs="0"/>
    <xs:element name="UniqueID" type="UniqueID_Type" maxOccurs="5">
    <xs:annotation>
    <xs:documentation xml:lang="en">This allows a user to send more than one UniqueID where there is more than one UniqueID associated to a single reservation (e.g. confirmation number and PNR record locator).</xs:documentation>
    </xs:annotation>
    </xs:element>
    <xs:element name="Verification" type="VerificationType" minOccurs="0" maxOccurs="5">
    <xs:annotation>
    <xs:documentation xml:lang="en">This is to be used for verification that the record being canceled is the specific record requested. This is optional and is intended to provide a more secure mechanism to ensure the correct record is being canceled. </xs:documentation>
    </xs:annotation>
    </xs:element>

    Here ter are 3 <xs:element> within a xs:sequence tag.Here the types-POS_Type,UniqueID_Type and VerificationType works.But in my previous case there is only one element .

    In that case it is not working.So I think the problem is not that the types are not getting referred,the problem is with the above case only.

Similar Threads

  1. JAXB Unmarshalling
    By milan.nosal in forum XML
    Replies: 0
    Last Post: 09-01-2010, 02:15 PM
  2. JAXB Binding
    By Fusebox in forum XML
    Replies: 0
    Last Post: 06-11-2010, 10:06 PM
  3. Replies: 0
    Last Post: 02-22-2010, 05:15 AM
  4. Replies: 0
    Last Post: 02-22-2010, 04:37 AM
  5. Jaxb
    By Paul Richards in forum XML
    Replies: 1
    Last Post: 08-03-2009, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •