W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

RE: complexType's typedef

From: Mark Feblowitz <mfeblowitz@frictionless.com>
Date: Fri, 25 Jan 2002 13:54:47 -0500
Message-ID: <4DBDB4044ABED31183C000508BA0E97F024D5791@fcpostal.frictionless.com>
To: "'wu.liu@verizon.com'" <wu.liu@verizon.com>, xmlschema-dev@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT