When using the Xerces 2.8.1 XML Schema API, the derived type from this
schema:

<?xml version="1.0" ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema";
        targetNamespace="urn:webalo:try-extension"
        xmlns:tns="urn:webalo:try-extension">

    <element name="root" type="tns:Derived"/>

    <complexType name="Base">
        <sequence>
            <element name="a" type="string"/>
            <element name="b" type="string"/>
        </sequence>
    </complexType>

    <complexType name="Derived">
        <complexContent>
            <extension base="tns:Base">
                <sequence>
                    <element name="c" type="string"/>
                    <element name="d" type="string"/>
                    <element name="e" type="string"/>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
</schema>

is represented in that API as though it had content model:

    <complexType name="Derived">
        <sequence>
          <sequence>
            <element name="a" type="string"/>
            <element name="b" type="string"/>
          </sequence>
          <sequence>
            <element name="c" type="string"/>
            <element name="d" type="string"/>
            <element name="e" type="string"/>
          </sequence>
       </sequence>
    </complexType>

rather than what I would have naively thought:

    <complexType name="Derived">
        <sequence>
            <element name="a" type="string"/>
            <element name="b" type="string"/>
            <element name="c" type="string"/>
            <element name="d" type="string"/>
            <element name="e" type="string"/>
       </sequence>
    </complexType>

That is, the XSModelGroup representing the content of the type has two
particles, each of which has a term which is an XSModelGroup, one with
two and one with three particles.

I have a test program to demonstrate this, if it is needed.

Is this expected behavior and is it documented somewhere?

What I've found elsewhere includes:

a.  "A complex type which extends another does so by having additional
content model particles at the end of the other definition's content
model, or by having additional attribute declarations, or both."

from XML Schema 1.0 Second Edition, section 2.2.1.3, which seems to
suggest the form I had expected.

b.  On the other hand, the infoset description, 3.4.1 which suggests
there is a separate "base type definition" and "content type" which
contains a content model, which could suggest the nested form found in
my test.

c.  The documentation for the XSComplexTypeDefinition.getParticle()
method refers to "A particle for a mixed or element-only content model...".

Thanks for any illumination.

Jeff


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to