Re: Extension of xs:simpleContent

Hi Pete,
   I believe the schema you've posted is correct (I cross checked with
Xerces too). I think for simpleContent instances, schema component
complexContent can be used technically as well (since simpleContent is
a subset of complexContent).

Though I would have designed the schema type "DoubleBaseExtension"
specified in your example, to use simpleContent rather than
complexContent (as you rightly said too).

On Wed, Nov 17, 2010 at 10:45 PM, Pete Cordell <petexmldev@codalogic.com> wrote:
> I have a customer who has a schema that extends a simple type double into a
> complex type with simple content, and then as a separate construct extends
> that into a complex type with complex content.  They do this along the
> following lines:
>
>   <xs:complexType name="DoubleBase">
>       <xs:simpleContent>
>           <xs:extension base="xs:double">
>               <xs:attribute name="DoubleBaseAttr" type="xs:boolean"/>
>           </xs:extension>
>       </xs:simpleContent>
>   </xs:complexType>
>
>   <xs:complexType name="DoubleBaseExtension">
>     <xs:complexContent>
>           <xs:extension base="DoubleBase">
>               <xs:attribute name="DoubleExtensionAttr" type="xs:boolean"/>
>           </xs:extension>
>       </xs:complexContent>
>   </xs:complexType>
>
> (To avoid confusion, the intent of the latter is to add the
> DoubleExtensionAttr attribute rather than mandate that you've got
> complexContent.)
>
> My feeling is this is wrong because DoubleBaseExtension should specify
> xs:simpleContent rather than xs:complexContent.
>
> However, XML Spy and Visual Studio seem to accept the above, and the example
> is actually based on a industry consortium schema that specifies similar
> constructs.
>
> So my questions are:
>
> 1) Is the above schema correct or not?
>
> 2) If it is technically incorrect, is it widely occurring (possibly because
> tools fail to pick it up) and therefore worth overlooking this error?
>
> Thanks,
>
> Pete Cordell
> Codalogic Ltd
> Interface XML to C++ the easy way using C++ XML
> data binding to convert XSD schemas to C++ classes.
> Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
> for more info





-- 
Regards,
Mukul Gandhi

Received on Wednesday, 17 November 2010 17:50:58 UTC