Re: [xml-dev] XML Schema question

From
Stephen Green <>
To
XML Developers List <>
Date
2011-03-02T09:07:45Z
ID
<AANLkTikw-3PE+mcOMYsdg+k5jLr7=Az2y2a1=>
Thread
Re: [xml-dev] XML Schema question
I came across this while trying to subset WXS and explain the use of
the subset and it is partly a curiosity to me but partly it raises questions
about what is minimally required for maximum simplicity with maximum
utility in a MicroXSD subset:

Are these three ways to do exactly the same thing, i.e. defined precisely
the same constraints on an XML instance (in this case a single element
named 'Greeting' of datatype 'string' <Greeting>Hello World</Greeting>)?

1.
<schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified">
     <element name="Greeting">
         <complexType>
             <simpleContent>
                 <extension base="string"/>
             </simpleContent>
         </complexType>
     </element>
</schema>

2.
<schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified">
     <element name="Greeting">
         <simpleType>
             <restriction base="string"/>
         </simpleType>
     </element>
</schema>

3.
 <schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified">
     <element name="Greeting" type="string"/>
</schema>

I kind of tend to want to remove such redundancy unless there is some
value keeping three ways to do the same thing. I guess a processor
trying to take of advantage of only having to conform to the conformance
target of the subset might prefer to only have to handle one kind of rep-
resentation in the markup. I prefer to prune out the attribute 'type' because
it introduces complications for my metaschema but I'm inclined to prune
away the simpleType as a child of an element and just keep simple type
for an attribute. Then a processor need only expect 'complexType' as
an element child. Does this make sense? Option 1 seems to give most
extensibility so why bother with 2 and 3?

Maybe some of the redundancy could have been removed from WXS
but I guess it is too late now to make big changes in any future version.

Not having to handle multiple namespaces makes a great difference
to the pain of explaining the subset - makes me happy about MicroXML.

Cheers


----
Stephen D Green






On 01/03/2011, Stephen Green <> wrote:
> OK, maybe it is impossible to get it perfect but I updated
> the MicroXSD subset of W3C XML Schema and gave it a
> version number '2012'  - "future-looking", "going-forward" :-)
>
> I have posted it on my blog
> http://stephengreenxml.blogspot.com/2011/02/microxsd.html
>
> Comments welcome
>
> ----
> Stephen D Green
>
>
>