users@jaxb.java.net

Re: Binding multiple schemas

From: Ed Mooney <Ed.Mooney_at_sun.com>
Date: Thu, 10 Apr 2003 23:35:32 -0400

Hi Lang,

I get the same result. Also, the outcome is sensitive to order:

     xjc.sh -p foo HLW1.xsd HBC5.xsd

yields a different result.

I'll file a bug, Lang. In the meantime, the workaround is to compile
each schema into a different package. That's the right thing to do,
anyway, for sets of schema where none specifies a targetNamespace.

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
Lang Tran wrote:
> I've run the JAXB binding compiler against two schema files provided by a
> third party: HBC5.xsd and HLW1.xsd.  They both compile fine but when I
> started to work with the generated classes, I noticed a discrepancy in the
> schema definition and the generated class for HBC5.  Both files define a
> element IN_DAT but the definitions are different.  It looks like the
> HBC5Type.java file somehow picked up the HLW1 definition instead of the
> complex type as defined in HBC5.  I'm wondering is this something that xjc
> should report as an error?  I'm running "xjc.sh *.xsd -package foo" with
> both files in the current working directory.
>
> ************
> HBC5.xsd
> ************
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
>         <xs:element name="HBC5">
>                 <xs:complexType>
>                         <xs:sequence>
>                                 ...
>                                 <xs:element ref="IN_DAT"/>
>                                 ...
>                         </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
>         <xs:element name="IN_DAT">
>                 <xs:complexType>
>                         <xs:sequence>
>                                 <xs:element ref="IN_DAY"/>
>                                 <xs:element ref="IN_MON"/>
>                         </xs:sequence>
>                 </xs:complexType>
>         </xs:element>
>         <xs:element name="IN_DAY">
>                 <xs:simpleType>
>                         <xs:restriction base="xs:nonNegativeInteger">
>                                 <xs:minInclusive value="01"/>
>                                 <xs:maxInclusive value="31"/>
>                                 <xs:totalDigits value="2"/>
>                         </xs:restriction>
>                 </xs:simpleType>
>         </xs:element>
>         <xs:element name="IN_MON">
>                 <xs:annotation>
>                         <xs:documentation>3-char alpha month. Example:
> "JAN"</xs:documentation>
>                 </xs:annotation>
>                 <xs:simpleType>
>                         <xs:restriction base="xs:string">
>                                 <xs:length value="3"/>
>                                 <xs:enumeration value="JAN"/>
>                                 ...
>                                 <xs:enumeration value="DEC"/>
>                         </xs:restriction>
>                 </xs:simpleType>
>         </xs:element>
>
>
> public interface HBC5Type {
>     ...
>
>     java.lang.String getINDAT();
>
>     void setINDAT(java.lang.String value);
>     ...
> }
>
> ************
> HLW1.xsd
> ************
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>         <xs:element name="HLW1">
>                 <xs:complexType>
>                         <xs:sequence>
>                                 ...
>                                 <xs:element ref="IN_DAT"/>
>                                 ...
>                         </xs:sequence>
>                         <xs:attribute name="frame" type="xs:string"
> use="optional"/>
>                 </xs:complexType>
>         </xs:element>
>         <xs:element name="IN_DAT">
>                 <xs:simpleType>
>                         <xs:restriction base="xs:string">
>                                 <xs:minLength value="5"/>
>                                 <xs:maxLength value="9"/>
>                         </xs:restriction>
>                 </xs:simpleType>
>         </xs:element>
>
>
>
> Lang Tran
> Senior Software Engineer
> ltran_at_hotwire.com
>
> Phone: 415-343-8646
> Fax: 415-343-8401
> 333 Market Street Suite 100
> San Francisco, CA 94105
>
> Hotwire.com
> Fly. Sleep. Drive. Cheap.
> ----------------------------------------------------------------------------
> -------------
> Flights      |      Hotels      |      Car Rentals      |      Packages
> |      Cruises
> ----------------------------------------------------------------------------
> -------------
>
> This email message is for the sole use of the intended recipient(s) and may
> contain
> confidential information.  Any unauthorized review, use, disclosure or
> distribution of this
> message is prohibited. If you are not the intended recipient of this message
> please contact
> the sender by reply email and destroy all copies of the original message.