Well, it's official: I'm thick. I have been programming years, but have never had to define an XML schema before and it is driving me up the wall. Despite looking at tens of examples, I just can't get the syntax right for defining an mandatory attribute on an element with the restriction that the attribute must be a number between 1 and 100.

I can't even get the following simpler example to work, which simply states the attribute must be a positive integer. The schema doesn't report any errors with this but when I try to use the attribute in an XML document, I get an error saying that the attribute is not defined.

This is my schema:
<xs:complexType name="ArtworkType">
<xs:element name="title" type="xs:string"/>
<xs:attribute name="ID" type="MyType2" use="required"/>

And this is my XML document:
xsi:schemaLocation="http://www.fourthwish.co.uk/data/Artworks.xsd Artworks.xsd"

<artwork ID="0">
<title>Title String</title>

<xs:attribute name="MyType2" type="xsositiveInteger"/>

Please help before I go mad.

Kind wishes, Patrick