Altova Mailing List Archives
>microsoft.public.xml Archive Home
>Thread Next - Re: How to provide a restriction value pair on a simple type?
Re: How to provide a restriction value pair on a simple type?
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 news:E231C8AD-9C3C-4666-BFE4-29AB99D34B66@m...... > 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 their > systems to provide additional information back to us as an XML document using > the specifications defined in the XSD. How would I provide this value pair? > 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 value > from the second restriction list. I'd like to have some kind of restriction > 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>