UPA question

I'm not sure if the following content model violates the UPA constraint:

    <xsd:complexType name="fooS">
      <xsd:sequence minOccurs="1" maxOccurs="2">
        <xsd:element name="s" type="xsd:string"
           minOccurs="0" maxOccurs="1"/>
        <xsd:element name="u" type="xsd:string" 
           minOccurs="1" maxOccurs="2"/>
      </xsd:sequence>
    </xsd:complexType>

On one hand, quoting 3.8.6 scc-upa:

    A content model must be formed such that during validation of an
    element information item sequence, the particle contained directly,
    indirectly or implicitly therein with which to attempt to validate
    each item in the sequence in turn can be uniquely determined without
    examining the content or attributes of that item, and without any
    information about the items in the remainder of the sequence.

When you see <s> or <u>, there's clearly only one particle that matches
them, so in that sense this might not look like UPA violation.

But on the other hand, quoting appendix H:

    A precise formulation of this constraint can also be offered in
    terms of operations on finite-state automaton: transcribe the
    content model into an automaton in the usual way using epsilon
    transitions for optionality and unbounded maxOccurs, unfolding other
    numeric occurrence ranges

If you unfold the numeric occurrence range as suggested by the above
paragraph, you get the following, which is clearly an UPA violation.

    (s?,u,u?),(s?,u,u?)?

And needless to say this is an incorrect content model for DTD.


Again quoting 3.8.6 scc-upa:

    NOTE:  This constraint reconstructs for XML Schema the equivalent
    constraints of [XML 1.0 (Second Edition)] and SGML.

If this content model is not an UPA violation, then it is not "the
equivalent constraints of XML1.0 and SGML."


I checked Xerces and XSV and both seem to think this content model is OK.

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi@sun.com

Received on Tuesday, 9 September 2003 12:57:50 UTC