In my XML schema definition, I'm trying to restrict the value of an attribute to be an integer between 0 and 100.
With reference to the sample schema below, I want attribute 'attr' on element 'root' to have this restriction. To achieve this I define a simpleType 'Percentage' and set this as the 'type' of 'attr'.
However, my XML schema editor (VS 2008) flags the attribute up as having a problem: "Type 'Percentage' is not declared or is not a simple type".
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" id="test" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://testtttt">
<xs:simpleType name="Percentage">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="root">
<xs:complexType>
<xs:attribute name="attr" type="Percentage" use="optional" />
</xs:complexType>
</xs:element>