E
Ed Slen
Hi, Guys!
Have a question about xsd restriction:
I am having an element "state" and it could be US state (Which is
easy) or Canadian postal code which is easy too (both rules are
working separately), but I am having difficulties combining this two
rules together.
Here is what I have tried:
<xsd:simpleType name="StateType">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsdattern value="[a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="b:usState">
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
<xsd:simpleType name="usState">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="AL"/>
<!—and all of other states up to: à
<xsd:enumeration value="WY"/>
</xsd:restriction>
</xsd:simpleType>
this gives enumeration error if I use Canadian postal code.
Please, help!
What am I doing wrong?
Thanks in advance!
Have a question about xsd restriction:
I am having an element "state" and it could be US state (Which is
easy) or Canadian postal code which is easy too (both rules are
working separately), but I am having difficulties combining this two
rules together.
Here is what I have tried:
<xsd:simpleType name="StateType">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsdattern value="[a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="b:usState">
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
<xsd:simpleType name="usState">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="AL"/>
<!—and all of other states up to: à
<xsd:enumeration value="WY"/>
</xsd:restriction>
</xsd:simpleType>
this gives enumeration error if I use Canadian postal code.
Please, help!
What am I doing wrong?
Thanks in advance!