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:simpleTy pe name="StateType ">
<xsd:union>
<xsd:simpleType >
<xsd:restrictio n base="xsd:strin g">
<xsd:pattern value="[a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d" />
</xsd:restriction >
</xsd:simpleType>
<xsd:simpleType >
<xsd:restrictio n base="b:usState ">
</xsd:restriction >
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
<xsd:simpleTy pe name="usState">
<xsd:restrictio n base="xsd:NMTOK EN">
<xsd:enumeratio n value="AL"/>
<!—and all of other states up to: à
<xsd:enumeratio n 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:simpleTy pe name="StateType ">
<xsd:union>
<xsd:simpleType >
<xsd:restrictio n base="xsd:strin g">
<xsd:pattern value="[a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d" />
</xsd:restriction >
</xsd:simpleType>
<xsd:simpleType >
<xsd:restrictio n base="b:usState ">
</xsd:restriction >
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
<xsd:simpleTy pe name="usState">
<xsd:restrictio n base="xsd:NMTOK EN">
<xsd:enumeratio n value="AL"/>
<!—and all of other states up to: à
<xsd:enumeratio n 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!
Comment