RE: complexType's typedef

I'll try this one.

What you're doing is saying that elements first and second are required -
that there can be at least and at most one of each. You're declaring that
every thing of type MyStructType has a first and a second.

Derivation by restriction only allows you to tighten restrictions on a
definition, and you can't be any more constrained that minOccurs="1" and
maxOccurs="1". By removing the elements you've violated 

derivation-ok-restriction.5.2

and by removing the sequence entirely, you've violated 

cos-particle-restrict.2

If you were to assign the sequence and the elements minOccurs="0", you are
saying that that these occur optionally (0 or 1 time), and so removing them
tightens the restriction to the tighter restriction of 0 or 0 times. That
should work.


----------------------------------------------------------------------------
----
 
Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188 
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor 
Cambridge, MA 02139 
www.frictionless.com  
 

 -----Original Message-----
From: 	wu.liu@verizon.com [mailto:wu.liu@verizon.com] 
Sent:	Thursday, January 24, 2002 5:49 PM
To:	xmlschema-dev@w3.org
Subject:	complexType's typedef

Hi,

I have 2 data structures:
===============================================
struct MyStructType
{
      string      first;
      string      second;
};

typedef  MyStructType  MyTypedefType;
===============================================

The corresponding datatype for MyStructType in schema is:
=====================================================================
<complexType name="MyStructType">
      <sequence>
            <element name="first" type=string"/>
            <element name="second" type="string"/>
      </sequence>
</complexType>
=====================================================================

But how to treat typedef? The following definition gives me error:
=====================================================================
<complexType name="MyTypedefType">
      <restriction base="MyStructType "/>
</complexType>
=====================================================================

Please advise.

Thanks,
Wu

Received on Friday, 25 January 2002 13:55:20 UTC