EDN Admin
Well-known member
I have the following as part of a schema:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; FieldTag<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ListCode<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:string<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; enumeration <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ABCD<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; enumeration <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; XYZ<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; enumeration <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; YYZ<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ProprietaryCode<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:string<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; maxLength <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 35<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
[/code]
What I want to do is to put a condition or constraint on the value of the ListCode element. If the ListCode value is "YYZ", then the ProprietaryCode element is required. Otherwise, if ListCode is ABCD or XYZ, then the "ProprietaryCode" IS NOT
required.
It would also be a validation error if the ProprietaryCode element was provided for a ListCode of ABCD or XYZ.
Example 1. If the ListCode = ABCD or XYZ, the "ProprietaryCode" element IS NOT required. No validation error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >ABCD<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
Example2. If the ListCode = YYZ, the following would generate a validation error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >YYZ<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
Example 3. If the ListCode = YYZ and "ProprietaryCode" is provided, no error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >YYZ<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >Some kind of value<span style="color:Blue; </<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
Example 4. Providing the ProprietaryCode element when the ListCode is not YYZ is a validation error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >ABCD<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >Validate Error expected<span style="color:Blue; </<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
<br/>
I checked some examples here, but didnt find anything that I could get to work:
http://www.w3.org/wiki/Co-constraint_Use_Cases http://www.w3.org/wiki/Co-constraint_Use_Cases
Thanks. Jeff
View the full article
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; FieldTag<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ListCode<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:string<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; enumeration <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ABCD<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; enumeration <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; XYZ<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; enumeration <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; YYZ<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ProprietaryCode<span style="color:Black; " <span style="color:Red; minOccurs<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:string<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; maxLength <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 35<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; sequence<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; complexType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >
[/code]
What I want to do is to put a condition or constraint on the value of the ListCode element. If the ListCode value is "YYZ", then the ProprietaryCode element is required. Otherwise, if ListCode is ABCD or XYZ, then the "ProprietaryCode" IS NOT
required.
It would also be a validation error if the ProprietaryCode element was provided for a ListCode of ABCD or XYZ.
Example 1. If the ListCode = ABCD or XYZ, the "ProprietaryCode" element IS NOT required. No validation error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >ABCD<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
Example2. If the ListCode = YYZ, the following would generate a validation error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >YYZ<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
Example 3. If the ListCode = YYZ and "ProprietaryCode" is provided, no error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >YYZ<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >Some kind of value<span style="color:Blue; </<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
Example 4. Providing the ProprietaryCode element when the ListCode is not YYZ is a validation error.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; FieldTag<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ListCode<span style="color:Blue; >ABCD<span style="color:Blue; </<span style="color:#A31515; ListCode<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >Validate Error expected<span style="color:Blue; </<span style="color:#A31515; ProprietaryCode<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; FieldTag<span style="color:Blue; >
[/code]
<br/>
I checked some examples here, but didnt find anything that I could get to work:
http://www.w3.org/wiki/Co-constraint_Use_Cases http://www.w3.org/wiki/Co-constraint_Use_Cases
Thanks. Jeff
View the full article