|
top
|
Subject: [OT] XSD - is this valid XML or not? Author: (Deleted User) Date: 31 Jan 2008 06:51 PM Originally Posted: 31 Jan 2008 06:50 PM
|
Jeni Tennison was kind enough to answer my query on this topic, and here is her view. She refers to her earlier posts (2002) on this forum.
---------
I think it's OK. As the post you refer to makes clear, empty <choice>s
are legal, just never satisfiable. Here, the empty <choice> is within
another <choice> which has an alternative (namely a <gml:Grid> element).
And the whole thing is wrapped in an optional sequence. As far as I can
tell, that means that something with GridDomainType would be legal if it was empty (the sequence is optional) or if it contains a single
<gml:Grid> element.
There might be a problem if GridDomainType isn't a legal restriction of
gml:DomainSetType, of course, but I don't know if that's the case (the
restriction rules in XML Schema are notoriously hard to follow, even if
I had the original definition).
> What’s your view, in 2008? And what would you change that fragment to,
> to better reflect the intent?
Of course it would be possible to rewrite it to:
<xs:sequence minOccurs="0">
<xs:element ref="gml:Grid" />
</xs:sequence>
I suspect that the fact it *isn't* written like that is due to the
tricky restriction rules (or possibly it's machine-generated in some way).
Cheers,
Jeni
--
Jeni Tennison
http://www.jenitennison.com
---------
That may be of interest to some others on this forum.
**********
Ian Thomas
--------------
Stylus Studio 2008 XML Enterprise Suite R1 (Build 1050e)
|
|
|