Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - RE: Default and Fixed Values of attributes [Thread Next] Re: FacetsTo: <Farid.Mahini@------.--->, <xmlschema-dev@--.---> Date: 2/15/2005 5:35:00 AM
> I have an XML document which contains the list of acceptable values
(strings
> or enum) for some elements, in addition to the elements themselves. I
need
> to create a schema to validate this XML document. Is there a way to make
the
> validation process aware of these facets (on the fly, if you will). I
hope
> the simple XML test file below clarifies my question.
>
What you will want to do is have a simpleType that is restricted as an
Enumeration. Something like this:
<xsd:element name="Types">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Analog"/>
<xsd:enumeration value="Digital"/>
<xsd:enumeration value="Bus"/>
<xsd:enumeration value="Undefined"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
HTH,
Bryce K. Nielsen
SysOnyx, Inc. (www.sysonyx.com)
Makers of xmlDraft, the Smart XSD Editor
http://www.sysonyx.com/products/xmldraft
From Farid.Mahini@L... Tue Feb 15 20:28:49 2005
Received: from bart | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
