redefine and target namespace

  Hi,

  I have a schema document that redefines a complex type as
following:

    <xs:redefine schemaLocation="redefine.xsd">
       <xs:complexType name="root">
          <xs:complexContent>
             <xs:extension base="tns:root">
                <xs:sequence>
                   <xs:element name="b" type="xs:string"/>
                </xs:sequence>
             </xs:extension>
          </xs:complexContent>
       </xs:complexType>
    </xs:redefine>

  I thought the element 'b' was defined in the target namespace,
but it seems it has to be in no namespace.  Is it really the
intent of the spec?  Did I do anything wrong?  I use Xerces 2 for
Java (as in Java SE 6.)

  redefine.xsd:

    <?xml version="1.0" encoding="UTF-8"?>

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:tns="tns"
               targetNamespace="tns"
               elementFormDefault="qualified">

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

       <xs:complexType name="root">
          <xs:sequence>
             <xs:element name="a" type="xs:string"/>
          </xs:sequence>
       </xs:complexType>

    </xs:schema>

  redefine-red.xsd:

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               targetNamespace="tns"
               xmlns:tns="tns">

       <xs:redefine schemaLocation="redefine.xsd">
          <xs:complexType name="root">
             <xs:complexContent>
                <xs:extension base="tns:root">
                   <xs:sequence>
                      <xs:element name="b" type="xs:string"/>
                   </xs:sequence>
                </xs:extension>
             </xs:complexContent>
          </xs:complexType>
       </xs:redefine>

       <xs:element name="redefined" type="tns:root"/>

    </xs:schema>

  Valid redefine.xml:

    <tns:redefined xmlns:tns="tns">
       <tns:a>bla</tns:a>
       <b>bla</b>
    </tns:redefined>

  Expected valid redefine.xml (but actually invalid):

    <redefined xmlns="tns">
       <a>bla</a>
       <b>bla</b>
    </redefined>

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/






















      

Received on Sunday, 25 October 2009 18:06:15 UTC