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:elemen t name="shoesize" >
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base="xs:intege r">
<xs:attribute name="country" type="xs:string " />
</xs:extension>
</xs:simpleConten t>
</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.