- From: <noah_mendelsohn@us.ibm.com>
- Date: Mon, 13 Oct 2008 16:27:28 -0400
- To: "Michael Kay" <mike@saxonica.com>
- Cc: "'Andrew Welch'" <andrew.j.welch@gmail.com>, xmlschema-dev@w3.org, xmlschema-dev-request@w3.org
Michael Kay writes: > It does raise the question of why simple types are something > radically different from complex types, rather than simply a > special case of a complex type that happens to define no > children and no attributes. For what it's worth, this was debated at great length during the design of Schema 1.0. Perhaps others will recollect differently, but I don't recall the analysis leading to a simple clear winner in the design space. Not sure I could reproduce the pros and cons these many years later, but I think it was along the following lines: we could have made no distinction in general between complex and simple types. We then would have been in the position of saying that a type that just happened to have no attributes and happened to have stringlike content was special, and in particular could be used as the type of an attribute. The alternative was to do what we did, which was to make a separately named abstraction for what we now know as simple and complex types. For the most part, they are naturally disjoint, but the messy case is the one in question here, I.e. that the degenerate case of a complex type (I.e. no attributes and no element content) is mighty close to a simple type in what it does. So, we could have tried to collapse just that case. Take a complex type with simple content and an optional attribute, and now restrict away the attribute. Should it magically turn into a simple type? Hmm. Seems a bit magical. Anyway, I doubt I'm getting all the details right, but as I recall the discussion felt somewhat like that. As I say, I didn't recall an obviously "best" choice, and the one way made seemed to be among the less painful/bizarre. To some degree, all of this is a reflection of the assymmetry in XML between attribute and element content: if XML attributes were just an unordered grouping of named items that allowed the same content as elements (I.e. structured), then I think the distinction between complex and simple types would have fallen away naturally. The content allowed by elements is a superset of that allowed for attributes, and that asymmetry must be reflected in the type system somehow. Noah -------------------------------------- Noah Mendelsohn IBM Corporation One Rogers Street Cambridge, MA 02142 1-617-693-4036 --------------------------------------
Received on Monday, 13 October 2008 20:28:15 UTC