WXS: Empty element with attributes

G

Gustaf Liljegren

I ran into this example in the XML Schema Primer:

<internationalPrice currency="EUR" value="423.46"/>

The element is defined like this:

<xsd:element name="internationalPrice">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="currency" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:decimal"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

It looks complex indeed. I wonder what the difference is between the
above and this:

<xsd:element name="internationalPrice">
<xsd:complexType>
<xsd:attribute name="currency" type="xsd:string"/>
<xsd:attribute name="value" type="xsd:decimal"/>
</xsd:complexType>
</xsd:element>

Both works on the XML snippet, according to those WXS validators I've
tried.

Thanks,

Gustaf
 
G

Gustaf Liljegren

Gustaf Liljegren said:
It looks complex indeed. I wonder what the difference is between the
above and this:

Forget the question. It's explained in the next paragraph in the primer!
Both are correct. I wish there was only one way to do it...

Gustaf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top