[Home] [By Thread] [By Date] [Recent Entries]
Hi Brian, Yes, you are correct that the new definition of AddressType should supercede the original one. If XML Spy doesn't accept the Mail_Stop element as a child of Address, that sounds like an implementation bug. Priscilla ------------------------------------------------------------------ Priscilla Walmsley priscilla@w... Vitria Technology http://www.vitria.com Author, Definitive XML Schema (Prentice Hall PTR) ------------------------------------------------------------------ > -----Original Message----- > From: Magick, Brian [mailto:Brian.Magick@C...] > Sent: Friday, March 29, 2002 2:24 PM > To: xml-dev@l... > Subject: 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 > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> > > <<attachment: winmail.dat>>
|

Cart



