Could anyone explain this schema structure?
- From: wesley.hall@xxxxxxxxx
- Date: 25 Nov 2005 03:27:58 -0800
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.
.
- Follow-Ups:
- Re: Could anyone explain this schema structure?
- From: Martin Honnen
- Re: Could anyone explain this schema structure?
- Prev by Date: Re: representing a directory structure in XML
- Next by Date: Controlling last-page content in FOP 0.20.5
- Previous by thread: Undefined elements XSD definition
- Next by thread: Re: Could anyone explain this schema structure?
- Index(es):
Relevant Pages
|