Hi i am working on making a basic shipping xml schema and i was wondering if there was a way to have the schema restrictions to work for both canadian and american postal codes:
<xs:simpleType name="postalCode">
<xs:restriction base="xs:string" >
<xs:pattern value="\d{3}-\d{3}"/>
</xs:restriction>
is there a way to have an "开发者_如何学Cor" in there so i could have the american postal code of just numbers work aswell?
Any comments or suggestions are appreciated. Thanks
Try with |
character to provide second (OR) option in your pattern e.g. (additional parentheses aren't necessary in here):
<xs:simpleType>
<xs:restriction base="xs:string" >
<xs:pattern value="\d{3}-\d{3}|\d{5}"/>
</xs:restriction>
</xs:simpleType>
精彩评论