W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2003

redefine a complexType

From: Navneet Raja <nraja@bevocal.com>
Date: Sat, 3 May 2003 14:29:49 -0700
Message-ID: <F73733CC5E11D41189E700D0B74A0C9E04F3E5D6@exchange.bevocal.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Hi All,
We have recently started to look at XML schemas as alternatives to DTDs in
our product. I had a simple query regarding the <redefine> element , as it
applies to extending a complexType.
 
I am trying to 'extend' a complexType , which is defined in the base schema
. The following are the simplified versions of my parent and child schemas:
 
Parent.xsd
--------------
.....
<complexType name="foo">
    <choice maxOccurs="unbounded">
        <element ref="a"/>
        <element ref="b"/>
        <element ref="c"/>
    <choice>
</complexType>
.......        
###########################
Child.xsd
---------------
.....
<redefine schemaLocation=Parent.xsd">
    <complexType name="foo">
        <complexContent>
            <extension base="foo">
                <choice maxOccurs="unbounded">
                    <element ref="d"/>
                    <element ref="e"/>
                <choice>
            </extension>
        </complexContent>
    </complexType>
</redefine>
.......        
 
So , I basically want to redefine the complexType "foo" to allow elements of
type "d" and "e" in addition to "a" , "b" and "c".
 
Then I have a simple instance document which looks like 
<foo> 
    <a> .... </a>
    <b> .... </b>
    <d> .... </d>
</foo>
 
 
When I refer to the child schema from this instance document and run it
through Xerces 2.3.0 for validation against the schema , I get an error
message of type "Invalid content starting with 'a' . One of 'd' is
expected." From the error message , it is clear that the redefinition above
actually did not inherit the elements from the parent.
 
Can you spot where the error might be ?
 
Thanks in advance,
-- Navneet
  
Received on Saturday, 3 May 2003 18:36:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:37 GMT