[XML Schema] Element with restriction and attribute
I am trying to write an XML Schema to validate some XML and the problem is that I can't seem to get an attribute on an element that has a restriction.
I want to validate this:
<email public="no">example@host.com</email>
But I want to make sure that the adress is actually an email adress by checking it with a regular expression:
<xs:element name="email">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="regex"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
But I also want the attribute. Problem is, I can't add it to a simpleType, so I need to give "email" a complexType. But doing that, restricts me from setting a restriction on the content of the element, because the parser says I can't use the xs:string-base for a restriction in a complexType.
I have searched for the answer to my question for a couple of days now and I still haven't found it. I really can't believe that nobody knows a solution, because I would think that it is kind of common to have something similar to what I want. Anyway, I hope someone will be able to help. Thanks!

