Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Facets

From: "Bryce K. Nielsen" <bryce@-------.--->
To: <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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent