Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XSD restriction to a set of string values >Thread Next - Re: XSD restriction to a set of string values Re: XSD restriction to a set of string valuesTo: NULL Date: 12/4/2008 3:00:00 PM Peter Olcott wrote:
> I need to know the syntax for restricting a type to a
> specific set of string values where these string values are
> not encoded as enumeration types.
You could use a regular expression pattern e.g. this schema
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="foo" type="fooType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="fooType">
<xs:restriction base="xs:string">
<xs:pattern value="bar|baz"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
allows the values 'bar' and 'baz' for the 'foo' element.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
