Question: How can I restrict an attribute to not allow a particular value?

For instance, I have an `<xs:key/>` on an `Id` attribute of an element, but some yahoo has gone and thrown a magic number in there so now I cannot allow `3`, but `1`, `2`, and `5` are perfectly acceptable.

Answer: 
Have you tried having a look at the restriction tag [link text](http://www.w3schools.com/schema/schema_facets.asp), the code below, it should give you a tag called Id which only allows integers that doesn't start with a 3

```
<xs:key name="Id">
    <xs:simpleType>
        <xs:restriction base="xs:integer">
            <xs:pattern value="[^3]\d*"/>
       </xs:restriction>
  </xs:simpleType>
</xs:key>

```
I think a better pattern is `[^3]|..+` which accepts all numbers with at least 2 digits. However, it still allows `03` which is another representation of 3. To disallow that, you can try something like `[^3]|[^0].+` which disallows all representations with leading zeros.