Thanks for the reply Sandor.

I realized that I don't think this solution will work if other elements
reference overview or generalInfo.  Is there a way to accomplish this,
that is allowing for these elements to be accessible outside the scope of
'hotelInfo', as well?

Also, a similar, but seperate question: what if the two child elements an
element (call it, a) have different structures but the same name?

        Rgs,
        Zeb

:On Tue, 4 Feb 2003, Sandor KELEMEN wrote:
:
::> I've been given an XML spec by a hotel provider for access to their
::> system.
::>
::> In it, they define two elements, 'overview' and 'generalInfo'.  Both of
::> these elements are children of a mutual parent, 'hotelInfo'.  However,
::> according to their spec, 'overview' has a child element ALSO called
::> 'generalInfo', but one with a different contents than the 'generalInfo'
::> which is at the same level as 'overview'.
::>
::> First question: Is this legit?
::
::Yes.
::
::
::> Second question: If so, how do you map this in a .xsd file?
::
::Here are two possible solutions:
::
::1.
::----------------------------------------------------
::<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
::elementFormDefault="qualified" attributeFormDefault="unqualified">
::  <xsd:element name="hotelInfo">
::    <xsd:complexType>
::      <xsd:sequence>
::
::        <xsd:element name="overview">
::          <xsd:complexType>
::            <xsd:sequence>
::              <xsd:element name="generalInfo">
::                <xsd:complexType>
::                  <xsd:sequence>
::                    <xsd:element name="numBedrooms" type="xsd:string"/>
::                    <xsd:element name="numFloors"   type="xsd:string"/>
::                  </xsd:sequence>
::                </xsd:complexType>
::              </xsd:element>
::            </xsd:sequence>
::          </xsd:complexType>
::        </xsd:element>
::
::        <xsd:element name="generalInfo">
::          <xsd:complexType>
::            <xsd:sequence>
::              <xsd:element name="hotelId" type="xsd:string" minOccurs="1"/>
::              <xsd:element name="name" type="xsd:string" minOccurs="1"/>
::              <xsd:element name="streetAddress1" type="xsd:string"
::minOccurs="1"/>
::              <xsd:element name="streetAddress2" type="xsd:string"
::minOccurs="0"/>
::              <xsd:element name="city" type="xsd:string" minOccurs="1"/>
::              <xsd:element name="postalCode" type="xsd:string"
::minOccurs="1"/>
::              <xsd:element name="stateCode" type="xsd:string"
::minOccurs="1"/>
::            </xsd:sequence>
::          </xsd:complexType>
::        </xsd:element>
::      </xsd:sequence>
::    </xsd:complexType>
::  </xsd:element>
::</xsd:schema>
::----------------------------------------------------
::
::2.
::----------------------------------------------------
::<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
::elementFormDefault="qualified" attributeFormDefault="unqualified">
::
::  <xsd:element name="hotelInfo">
::    <xsd:complexType>
::      <xsd:sequence>
::
::        <xsd:element name="overview">
::          <xsd:complexType>
::            <xsd:sequence>
::              <xsd:element name="generalInfo" type="OverviewGeneralInfo"/>
::            </xsd:sequence>
::          </xsd:complexType>
::        </xsd:element>
::
::        <xsd:element name="generalInfo" type="HotelInfoGeneralInfo"/>
::      </xsd:sequence>
::    </xsd:complexType>
::  </xsd:element>
::
::  <xsd:complexType name="OverviewGeneralInfo">
::    <xsd:sequence>
::      <xsd:element name="numBedrooms" type="xsd:string"/>
::      <xsd:element name="numFloors"   type="xsd:string"/>
::    </xsd:sequence>
::  </xsd:complexType>
::
::  <xsd:complexType name="HotelInfoGeneralInfo">
::    <xsd:sequence>
::      <xsd:element name="hotelId" type="xsd:string" minOccurs="1"/>
::      <xsd:element name="name" type="xsd:string" minOccurs="1"/>
::      <xsd:element name="streetAddress1" type="xsd:string" minOccurs="1"/>
::      <xsd:element name="streetAddress2" type="xsd:string" minOccurs="0"/>
::      <xsd:element name="city" type="xsd:string" minOccurs="1"/>
::      <xsd:element name="postalCode" type="xsd:string" minOccurs="1"/>
::      <xsd:element name="stateCode" type="xsd:string" minOccurs="1"/>
::    </xsd:sequence>
::  </xsd:complexType>
::
::</xsd:schema>
::----------------------------------------------------
::
::best regards,
::Sanyi
::
::-----------------------------------------------------------
::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 010 8959.558
34 Nafsika St.       | Direct: +3 010 8995.875
Voula 16673          | Mobile: TBD
Greece               | e-Fax : 978 246.0770
                     | PGP id: 0x68B3A763

"Those who would give up essential liberty to purchase a little
 temporary safety deserve neither liberty nor safety."

                                        - Benjamin Franklin

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to