Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xs:choice and xs:sequence question

From: David Carver <d_a_carver@-----.--->
To: xmlschema-dev@--.---
Date: 1/12/2006 4:17:00 AM
George you are correct, after re-running some tests yesterday none of 
the processors validated it, not sure what happened on the first run 
with Xerces and XSV.   Anyway, I did finally manage to get working what 
I wanted by doing the following:

This works:
    <xs:complexType name="ProcessingOutcomeMessage">
        <xs:choice>
            <xs:sequence>
                <xs:element name="ApplicationReasonCode" 
type="ApplicationReasonCode" />
                <xs:element name="Description" type="Description" 
maxOccurs="unbounded" />
                <xs:element name="MessageReasonCode" 
type="MessageReasonCode" />
            </xs:sequence>
            <xs:sequence>
                <xs:element name="Description" type="Description" 
minOccurs="0" maxOccurs="unbounded" />
                <xs:element name="MessageReasonCode" 
type="MessageReasonCode" minOccurs="0" />
            </xs:sequence>
        </xs:choice>
    </xs:complexType>

The below doesn't work:

  <xs:complexType name="ProcessingOutcomeMessage">
      <xs:choice>
          <xs:sequence>
              <xs:element name="Description" type="Description" 
minOccurs="0" maxOccurs="unbounded" />
              <xs:element name="MessageReasonCode" type="Description" 
minOccurs="0" />
          </xs:sequence>
          <xs:sequence>
              <xs:element name="Description" type="Description" 
minOccurs="1" maxOccurs="unbounded" />
              <xs:element name="MessageReasonCode" 
type="MessageReasonCode" minOccurs="1" />
              <xs:element name="ApplicationReasonCode" 
type="ApplicationReasonCode" minOccurs="1">
                  <xs:annotation>
                      <xs:documentation 
source="http://www.starstandard.org">Contains a software specific 
application reason code.</xs:documentation>
                  </xs:annotation>
              </xs:element>
          </xs:sequence>
      </xs:choice>
  </xs:complexType>



The only way to get this to work was to have ApplicationReasonCode as 
the ApplicationReasonCode as the first element in the first sequence.  
If it was included after MessageReasonCode in the first sequence, every 
parser would complain about not being able to determine how to handle 
the Description element.   I would have thought that it wouldn't have 
mattered what order the elements were setup in the sequence but 
apparently in this case it does.   It would have been helpful if the 
specs were a bit clearer on exactly what has to occur in this type of 
situation.   Anyways, it now validates against Xerces, XSV, XMLSpy">XMLSpy, 
MSXML and Oxygen.



From dvint@d... Thu Jan 12 15:48:06 2006
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3


transparent
Print
Mail
Digg
delicious
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