Lists Home |
Date Index |
On Thursday 05 December 2002 20:14, Joe English wrote:
> It seems to me that the "International Purchase Order" schema
> in section 4 of the W3C XML Schema Primer  comes close to the
> edge of that slippery slope. While _most_ of it can be processed
> by WXS-oblivious tools, there are some tasks that can't be done
> (or can't be done easily) without a type-annotated PSVI and full
> schema information. For instance: write a program that extracts
> all of the comments from a purchase order (see the schema fragment
> in section 4.6), Now you could do this with an XSL transform that
> extracted all the 'ipo:shipComment' and 'ipo:customerComment'
> elements (since those are the only two elements defined to
> be of that type), but that's fragile; if the schema is extended
> to include other comment types, the transform will silently
That's an argument *for* typing - but not done the way XSD does it!
Those two elements (shipComment and customerComment) are both comments,
typewise. They may be other types too in a type system with inheritance, of
course, such as 'text in language associated by nearest xml:lang' and
'string' and so on.
Now, with type information you *can* extract all the comments, no matter what
they are called. XSD might have you get that type information by referencing
the XSD itself or with xsi:type, whereas the alternative is to make a
convention that element names are type names and make sure that all comments
are in elements called <comment> and all titles in <title> and so on.
The latter approach has problems when you want two different comments in the
same element, though; by using the names of the children as types you remove
the ability to give them names expressing their relationship to the parent.
There's something to be said for mechanisms like xsi:type that attach the
typing as explicit metadata, but without requiring the loading and processing
(according to complex rules) of a schema, in those cases...
A city is like a large, complex, rabbit