> 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?

I'm not sure I understand what you mean on "referencing" overview and
generalInfo.

If you mean <xsd:element ref="overview"/> kind of referencing, it works only
for global element declarations (the referenced element must be directly
under the <schema> element defined).

[Further info under:
http://www.w3.org/TR/xmlschema-1/#declare-element ]

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

In XSD it can be expressed like this (just an example):
-------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified" attributeFormDefault="unqualified">

  <xsd:element name="test" type="Test"/>

  <xsd:complexType name="Test">
    <xsd:sequence>
      <xsd:element name="questions" type="Questions"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="TwoOptionQuestion">
    <xsd:sequence>
      <xsd:element name="option1" type="xsd:string"/>
      <xsd:element name="option2" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ThreeOptionQuestion">
    <xsd:sequence>
      <xsd:element name="firstOption" type="xsd:string"/>
      <xsd:element name="secondOption" type="xsd:string"/>
      <xsd:element name="thirdOption" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Questions">
    <xsd:sequence>
      <xsd:element name="question" type="TwoOptionQuestion" minOccurs="0"
maxOccurs="unbounded"/>
      <xsd:element name="question" type="ThreeOptionQuestion" minOccurs="0"
maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>
-------------------------

A valid XML for this schema:
-------------------------
<?xml version="1.0"?>
<test>
  <questions>
    <question>
      <option1>Bla..</option1>
      <option2>Blabla..</option2>
    </question>
    <question>
      <firstOption>Bla..</firstOption>
      <secondOption>Blabla..</secondOption>
      <thirdOption>Blabla..</thirdOption>
    </question>
  </questions>
</test>
-------------------------

I don't know how Castor's source code generator and marshall/unmarshall
mechanism will handle such an XSD.... must try it...

regards,
Sanyi

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

Reply via email to