Proper implementation of <redefine>
Question regarding the usage and implementation of redefine: As I've read in numerous texts, and as is made clear (or as clear as clear can be from the W3C) in Schema Primer Part 0, the <redefine> element will actually "replace" the external definition of a type or group. The redefined definition of the structure should take place anywhere the original structure was defined as a type or group. For example, (from the W3C Primer) if you redefine and extend AddressType, the new AddressType will occur anywhere the old AddressType was declared (within the same namespace). The Primer Part 0 states: "Outside of the redefine element, any such attempt to define a complex type with the same name (and in the same namespace) as the base from which it is being derived would cause an error. But in this case, there is no error, and the extended definition of Address becomes the only definition of Address." The primer continues with "Now that Address has been redefined, the extension applies to all schema components that make use of Address." This seems VERY clear to me that the new AddressType supercedes the old, everywhere...PERIOD. Unfortunately, a popular XML Schema editing tool with a very 007'ish flair to the name, (ok, no need to protect the guilty...XML Spy...Version 4.3 to be exact) seems to miss the proper implementation of <redefine>. Perhaps my understanding of <redefine> is flawed, or perhaps XML Spy has got this wrong, but when I redefine a type such as AddressType, and in another element in the new Schema set the type to "AddressType", it retains the original type definition and does not include the extensions that I've added to AddressType. The following snippet of Schema displays the structure that I am using: <xs:redefine schemaLocation="Address.xsd"> <xs:complexType name="AddressType"> <xs:complexContent> <xs:extension base="AddressType"> <xs:sequence> <xs:element name="Mail_Stop" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="Address" type="AddressType"/> </xs:schema> The Address element within XML Spy does not have the Mail_Stop element that was just added via the <redefine> element. Any suggestions as to whether I made an error or whether this is an apparent implementation bug? Brian Magick
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format