Altova Mailing List Archives

Re: How to provide a restriction value pair on a simple type?

From: "Zafar Abbas [MSFT]" <zafara@---------.--->
Date: 8/17/2004 1:04:00 PM
XSD does not provide this funcationality of validating content of one
element based on the value of another. You will probably have to write an
application layer on top of the XSD validation to perform this custom check.

"Vincent" <Vincent@d...> wrote in message
> Hopefully someone can provide me a quick answer, as we have an aggressive
> Project Schedule.
> Currently, I have to provide a pre-generated list of value pairs inside an
> XSD to a customer. They will be using this value pair to do lookups in
> systems to provide additional information back to us as an XML document
> the specifications defined in the XSD. How would I provide this value
> So far I've been able to generated a Simple Type with restriction on the
> value seperately for each value that I'm providing. However, there is no
> relationship between the two that ties them together. So if the customer
> chose to use value A from the first restriction list. They can use any
> from the second restriction list. I'd like to have some kind of
> that would only allow them to chose value A from the second list if they
> chose value A from the first. I have attached a sample of my current
> definitions in the XSD below.
> I'd appreciate any help. Thanks in advance.
> <xs:complexType name="ClientType">
> <xs:sequence>
> <xs:element minOccurs="1" maxOccurs="1" name="ClientID"
> type="ClientIDType" />
> <xs:element minOccurs="1" maxOccurs="1" name="ClientName"
> type="ClientNameType"/>
> </xs:sequence>
> </xs:complexType>
> <xs:simpleType name="ClientIDType">
> <xs:restriction base="xs:int">
> <xs:enumeration value="800" />
> <xs:enumeration value="801" />
> </xs:restriction>
> </xs:simpleType>
> <xs:simpleType name="ClientNameType">
> <xs:restriction base="xs:string">
> <xs:enumeration value="Johnson Healthcare" />
> <xs:enumeration value="New Healthcare" />
> </xs:restriction>
> </xs:simpleType>


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 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.