for example To validate the following element:
100
The constraint I want on the text
Inspired by Petru Gardea's answer to XSD custom type with attribute and restriction, I have come up with a solution that should work for you. Your element must be a complexType extending the restricted simpleType with an attribute:
In addition, if you want to extend multiple types with the same set of attributes, you could use the xsd:attributeGroup as suggested in C. M. Sperberg-McQueen's answer to XSD: Adding attributes to strongly-typed “simple” elements:
This would validate the following xml element:
100