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

RE: Extending "choice" model group in a xsd schema

From: Simon Cox <simon.cox@jrc.ec.europa.eu>
Date: Mon, 11 Jan 2010 09:17:42 +0100
To: <noah_mendelsohn@us.ibm.com>, "'Michael Kay'" <mike@saxonica.com>
Cc: "'Henry S. Thompson'" <ht@inf.ed.ac.uk>, "'Jaikiran Pai'" <jai_forums2005@yahoo.co.in>, <xmlschema-dev@w3.org>
Message-ID: <123B69140701474B8FDBBFF730545BA4@H07.jrc.it>
Of course XSD also supports the OO 'composition' pattern, using named model
groups. 
Many people prefer this to multiple-inheritance to achieve some of the same
outcomes.  


--------------------------------------------------------
Simon Cox

European Commission, Joint Research Centre, 
Institute for Environment and Sustainability, 
Spatial Data Infrastructures Unit, TP 262 
Via E. Fermi, 2749, I-21027 Ispra (VA), Italy 
Tel: +39 0332 78 3652
Fax: +39 0332 78 6325
mailto:simon.cox@jrc.ec.europa.eu 
http://ies.jrc.ec.europa.eu/simon-cox 

SDI Unit: http://sdi.jrc.ec.europa.eu/ 
IES Institute: http://ies.jrc.ec.europa.eu/
JRC: http://www.jrc.ec.europa.eu/
--------------------------------------------------------

-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of noah_mendelsohn@us.ibm.com
Sent: Friday, 8 January 2010 16:51
To: Michael Kay
Cc: 'Henry S. Thompson'; 'Jaikiran Pai'; xmlschema-dev@w3.org
Subject: RE: Extending "choice" model group in a xsd schema

Michael Kay writes:

> The odd thing though is that the OO languages I'm familiar withtreat 
> the fields/methods on a class as a set rather than a sequence, and a
subclass
> can add members to this set; so they don't have any kind of 
> user-visible constraint like the one in XSD that says the additions 
> have to be at the end of the sequence.

Ah, you youngsters.  In C++ it's pretty much a given that methods are mapped
to vtbls in a predictable order, or at least that's my impression. 
More to the point, the order of mapping of structure (and thus class) fields
is also significant.  Both of these orderings become part of the binary
interface for C++ objects on any given platform, as different compilations
of header files with references to the same classes need to get consistent
vtbl offsets. 

Then again, C++ is arguably irrelevant to the XML discussion precisely
because it does support multiple inheritance, with somewhat horrendous
implications for those vtbls under the covers;  that multiple inheritance
has no good analog in xsd:extension anyway, as far as I can see.  I agree
that most widely deployed scripting languages, as well as Java-class
languages tend to do name-based resolution at runtime, and in that sense
treat the members as sets.

Noah


--------------------------------------
Noah Mendelsohn
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








"Michael Kay" <mike@saxonica.com>
01/08/2010 10:35 AM
 
        To:     <noah_mendelsohn@us.ibm.com>, "'Henry S. Thompson'" 
<ht@inf.ed.ac.uk>
        cc:     "'Jaikiran Pai'" <jai_forums2005@yahoo.co.in>, 
<xmlschema-dev@w3.org>
        Subject:        RE: Extending "choice" model group in a xsd schema


> 
> I think there was an intuition on the part of some members of 
> the working group that extension would not only be similar in 
> spirit to what is done for data inheritance in OO programming 
> languages, but that it would facilitate serialization of such 
> OO structures to XML. 

I thought it was probably something along those lines.

The odd thing though is that the OO languages I'm familiar with treat the
fields/methods on a class as a set rather than a sequence, and a subclass
can add members to this set; so they don't have any kind of user-visible
constraint like the one in XSD that says the additions have to be at the 
end
of the sequence.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 
Received on Monday, 11 January 2010 08:18:43 GMT

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