Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Rearraging order of elements in a sequence.

From: Jeni Tennison <jeni@------------.--->
To: Eric Sirois <easirois@------.--->
Date: 7/15/2004 4:17:00 PM
Hi Eric,

> The second test was to use restriction to clear the all the elements
> in the restriction and then add them back in the right order in
> using extension. In this case XSV and Saxonica seem to like this
> arrangement returning no errors, but Xerces returns the same
> particle is not the same as the base error and also an extra error
> stating that the base content model is not emptiable. Which is
> correct as per the spec?

I think that Xerces (and MSXML, FWIW) is correct here, and XSV and
Saxonica wrong. When you do a restriction, you can't empty a content
model unless it's emptiable (all the particles are optional). Your
original content model is:

  (a, b?, d*)

And this says that the <a> element must appear. Any restriction of
your original complex type must include an <a> particle. It would be
valid, however, to restrict it to:

  (a, b?)

and then base the extension on this. Try:

<xs:complexType name="dumpElements">
  <xs:complexContent>
    <xs:restriction base="rootType">
      <xs:sequence>
        <xs:element ref="a" />
        <xs:element ref="b" minOccurs="0" />        
      </xs:sequence>
      <xs:attribute name="test" />
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="addSequence">
  <xs:complexContent>
    <xs:extension base="dumpElements">
        <xs:sequence>
          <xs:element ref="c" />
          <xs:element ref="d" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

Note that the only reason you can do this rearrangement is that <d> is
optional in the original content model.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

From easirois@r...  Thu Jul 15 10:53:56 2004
Return-Path: <easirois@r...>
X-Or


transparent
Print
Mail
Like It
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