Ned Wolpert wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Folks-
> 
> I've been trying to simplfy my XML schema, and found something that to me
> should work, but it doesn't.  It's a question on the proper way to map complex
> types. In my example, I've defined Address as follows...
> 
>  <xsd:element name="Address">
>    <xsd:complexType>
>       <xsd:sequence>
>          <xsd:element name = "StreetAddress1" type="xsd:string"/>
>          <xsd:element name = "StreetAddress2" type="xsd:string"/>
>       </xsd:sequence>
>    </xsd:complexType>
>  </xsd:element>
> 
> The following is an element named WorkAddress which is of type Address.  This
> works in Castor
> 
>  <xsd:element name = "WorkAddress">
>      <xsd:complexType>
>         <xsd:simpleContent>
>            <xsd:extension base = "Address">
>            </xsd:extension>
>         </xsd:simpleContent>
>      </xsd:complexType>
>  </xsd:element>
> 
> That maps WorkAddress as a type of Address just fine.  But when I switch
> WorkAddress to this (With Address defined as above):
> 
>   <xsd:element name = "WorkAddress" type="Address"/>
> 
> Castor says "Type not found for element: WorkAddress"  Why is this the case?

Because Address as defined above is an element, not a complex type.

If you change your Address definition from it's current form:

  <xsd:element name="Address">
    <xsd:complexType>
       <xsd:sequence>
          <xsd:element name = "StreetAddress1" type="xsd:string"/>
          <xsd:element name = "StreetAddress2" type="xsd:string"/>
       </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

into:

    <xsd:complexType name="Address">
       <xsd:sequence>
          <xsd:element name = "StreetAddress1" type="xsd:string"/>
          <xsd:element name = "StreetAddress2" type="xsd:string"/>
       </xsd:sequence>
    </xsd:complexType>

it will work with:

<xsd:element name="WorkAddress" type="Address"/>


Hope that helps,

--Keith

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

Reply via email to