Could anyone explain this schema structure?



Hello,

I have worked with XML fairly extensively but have generally used DTDs
to describe the structure of my documents. Recently I decided to try to
pick up XML Schemas and have been following the w3cschools tutorial. I
was getting by fine until I came across one specific example...

They say that the element..

"<shoesize country="france">35</shoesize>"

Can be described using a schema like...

"<xs:element name="shoesize">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="country" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>"

What I dont understand here is the location of the xs:attribute element
in the schema. It seems to suggest that the attribute is a child of the
character data value (xs:extension). This feels uncomfortable to me,
surely the xs:attribute element would be better placed as a subelement
of xs:complex type making the shoesize element consist of a
'complexType' with 1 piece of simple content (an xs:integer) and one
attribute named country.

Is there a logical reason why the xs:attribute is a subelement of
xs:extension and if so, would somebody be kind enough to explain it to
me so that I can reconsile it in my head and move on?

Thank you very much for your time.

.



Relevant Pages

  • Re: Why do we need XML Schemas other than for automatic validation?
    ... I've written DTDs so far and read about XML Schemas. ... Schema is itself an XML document, so it's automatically processable, ...
    (comp.text.xml)
  • Re: my first xml schema - I think its good. Is it really?
    ... DTDs are inherently in conflict with namespace-aware processing of XML. ... Yes, Schema is more verbose. ...
    (comp.text.xml)
  • Re: Namespace question
    ... back when XML was new and XML was mostly being processed through tools also inherited from SGML. ... While it *might* have been possible to extend DTDs to deal with namespaces, it would have been somewhat ugly and the namespace committee fairly explicitly decided that it was better to leave them behind. ... Due to the order in which things were defined, there are actually two separate definitions of validity -- validity against the DTD and validity against the schema. ...
    (comp.text.xml)
  • Re: how to return xml document from a web service
    ... what specific XML you expect. ... If you have a schema that defines what you expect, ... The second issue with this approach is that XML is not a string. ... >> methods from the wire transport. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • my first Tck/Tk program... and an XML question
    ... program which takes an XML Schema file, ... a basic XML tree and allows the user to save it. ... proc open_schema { ...
    (comp.lang.tcl)