users@jaxb.java.net

Binding multiple schemas

From: Lang Tran <ltran_at_hotwire.com>
Date: Thu, 10 Apr 2003 18:04:59 -0700

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.