OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

redefine



If I have two Schemas as follows:

-----------------------------
upper_level.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="namespace" xmlns="namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

        <xsd:complexType name="top" abstract="true"/>

        <xsd:complexType name="middle">
                <xsd:complexContent>
                        <xsd:extension base="top"/>
                </xsd:complexContent>
        </xsd:complexType>

</xsd:schema>

lower_level.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="namespace" xmlns="namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        
        <xsd:redefine schemaLocation="Z:\XML\upper_level.xsd">
        
                <xsd:complexType name="top">
                        <xsd:complexContent>
                                <xsd:extension base="top">
                                        <xsd:sequence>
                                                <xsd:element name="number" type="xsd:int"/>
                                        </xsd:sequence>
                                </xsd:extension>
                        </xsd:complexContent>
                </xsd:complexType>
                
                <xsd:complexType name="bottom">
                        <xsd:complexContent>
                                <xsd:extension base="middle"/>
                        </xsd:complexContent>
                </xsd:complexType>
                
        </xsd:redefine>
        
</xsd:schema>
---------------------------------

Will an element of type bottom contain an element named number?  Essentially, since middle extends top in upper_level.xsd, and top is redefined in lower_level.xsd will middle extend from this new redefinition of top, or still extend the older version?

More importantly (for me anyway) if the following two Schemas also exist and are related to the first two:

---------------------------------
other_level.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="namespace" xmlns="namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xsd:include schemaLocation="Z:\XML\upper_level.xsd"/>
        
        <xsd:complexType name="ceiling">
                <xsd:sequence>
                        <xsd:element name="up" type="top"/>
                </xsd:sequence>
        </xsd:complexType>
        
</xsd:schema>

final_level.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="namespace" xmlns="namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xsd:include schemaLocation="Z:\XML\lower_level.xsd"/>
        <xsd:include schemaLocation="Z:\XML\other_level.xsd"/>
        
        <xsd:element name="finalElement">
                <xsd:sequence>
                        <xsd:element name="above" type="ceiling"/>
                        <xsd:element name="floor" type="top"/>
                </xsd:sequence>
        </xsd:element>

</xsd:schema>
---------------------------------

Since upper_level.xsd is included through both other_level.xsd and lower_level.xsd by final_level.xsd will the complexType definition used to define the top complexType (that is the type for the floor element) be the one in upper_level.xsd or the redefined version lower_level.xsd?  Also, since the above element references the ceiling complexType, which has an element of complexType top will this sub element (up) still be of the complexType top as defined in upper_level.xsd or will it automatically become of the complexType top redefined in lower_level.xsd (even though other_level.xsd makes no reference to lower_level.xsd)?

My guess is that anything new that reference top (either an element or an complexType that uses extension) will use the most *redefined* version.  However, the up element will still be of complexType top as defined in upper_level.xsd.

I understand that this might be a confusing example.  Sorry.   Let me know if anything needs to be clarified.  I've tried to play around and see what happens, but since I'm using XML Spy (which doesn't yet support redefine) I've had no luck.

Also, is the namespace name “namespace” valid?  I believe it is, since a namespace is just a unique string. right?  And, is “Z:\XML\[filename]” a valid anyURI value? I'm almost positive it is.

Thanks in advance,
Dan