Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zero Length Element Validation in a Schema

Status
Not open for further replies.

tim273

Programmer
Aug 29, 2001
9
US
Hello Everyone,

I writing a schema where several elements are required, but but may not have any length. For example:

<CurrencyCode>USD</CurrencyCode>

is valid. But this is also valid:

<CurrencyCode/>

I want to create an element decleration that allows for zero length, but when there is data, it validates that it is a certian type. The example above would be a list currency types, but nulls are also allowed. Here's what I currently have in my schema:

<xs:simpleType name=&quot;currencyCodeType&quot;>
<xs:restriction base=&quot;xs:string&quot;>
<xs:enumeration value=&quot;USD&quot;/>
<xs:enumeration value=&quot;usd&quot;/>
</xs:restriction>
</xs:simpleType>

Any input would be appreicated. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top