Note that there are some explanatory texts on larger screens.

plurals
  1. POXSD condition based on element value
    primarykey
    data
    text
    <p>I have a situation with an object that has 3 properties: 1) action 2) ID 3) Name</p> <p><code>Action</code> can be <code>Update</code> or <code>Remove</code> and is mandatory. <code>ID</code> is an int and is mandatory. Name is a string and is Optional when <code>Action=Remove</code> and is mandatory when <code>Action=Update</code>.</p> <p>How do I describe this in XSD? Thank you!</p> <p>Jim</p> <p>This is what I have so far:</p> <pre><code> &lt;s:element name="UpdateAccount"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="myAccount" type="tns:WSUpdate" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;s:complexType name="WSUpdate"&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="ID" type="s:int" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="Name" nillable="false" type="s:string" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="action" type="tns:UpdateAction" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;s:simpleType name="UpdateAction"&gt; &lt;s:restriction base="s:string"&gt; &lt;s:enumeration value="Update" /&gt; &lt;s:enumeration value="Remove" /&gt; &lt;/s:restriction&gt; &lt;/s:simpleType&gt; </code></pre> <p><strong>EDIT Sep 12, 2012 @ 9:28am EST:</strong> After doing some more thinking, I have patched up something. This isn't exactly what I was looking for, but perhaps close enough for my client to accept. It doesn't exactly go into condition details, but it does give the structure definition to the client. What do you think?</p> <pre><code> &lt;s:element name="UpdateAccount"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:choice&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="myAccount" type="tns:WSUpdate" /&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="myAccount" type="tns:WSDelete" /&gt; &lt;/s:choice&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;s:complexType name="WSUpdate"&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="ID" type="s:int" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="Name" nillable="false" type="s:string" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="action" type="tns:UpdateAction" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;s:complexType name="WSDelete"&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="ID" type="s:int" /&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="Name" nillable="true" type="s:string" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="action" type="tns:UpdateAction" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;s:simpleType name="UpdateAction"&gt; &lt;s:restriction base="s:string"&gt; &lt;s:enumeration value="Update" /&gt; &lt;s:enumeration value="Remove" /&gt; &lt;/s:restriction&gt; &lt;/s:simpleType&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload