Hi Jeffry,
> What you're saying is that if I extend BookType in my Book element I
> create an anonymous type. So would this be basically the same as doing
> this?:
> <xs:complexType name="ExtendedBookType">
> <xs:complexContent>
[quoted text clipped - 11 lines]
> </xs:complexType>
> </xs:element>
No, now the type of Book is an anonymous type that is an extension of
ExtendedBookType, which itself is an extension of BookType. That's not the
same thing as:
<xs:element name="Book" substitutionGroup="Publication">
<xs:complexType>
<xs:complexContent>
<xs:extension base="BookType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
where the type of Book is an anonymous type that is an extension of BookType
(2 types instead of 3).
> And, the type of Book should derive DIRECTLY from the type of Publication?
> It is not that if Book derives from ExtendedBookType, ExtendedBookType
> derives from BookType and BookType derives from PublicationType, that I
> can substitute the Book element for the Publication element?
It doesn't have to be directly derived from it. But in your 2nd schema the
Publication element doesn't have the type PublicationType, it has an
anonymous type that is an extension of PublicationType. So what you have
is:
PublicationType
| |
anon1 BookType
|
anon2
where anon1 is the type of Publication and anon2 is the type of Book. anon2
is not considered to be derived from anon1 because it is not a descendent of
anon1.
Does that make sense?
Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------
> Hi Priscilla,
>
[quoted text clipped - 34 lines]
> Thanks a lot,
> Jeffry
Jeffry van de Vuurst - 29 Nov 2004 20:32 GMT
Oh stupid me, I meant to say this:
<xs:complexType name="ExtendedBookType">
<xs:complexContent>
<xs:extension base="BookType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Book" type="ExtendedBookType"
substitutionGroup="Publication">
</xs:element>
But that doesn't make a difference, because of your explanation:
PublicationType
| |
anon1 BookType
|
anon2
So in the case of what I meant to say, this diagram would look like
PublicationType
| |
anon1 BookType
|
ExtendedBookType
Also in this case the type of Book (ExtendedBookType) doesn't derive from
the type of Publication (anon1).
I think to point is, which I didn't know and you made perfectly clear, that
if an element extends a type, it now has an anonymous type that extends from
that type. And that's what causes all the confusion. Right? I hope so :)
Thanks you very much for your explanation.
Jeffry
> Hi Jeffry,
>
[quoted text clipped - 103 lines]
>> Thanks a lot,
>> Jeffry
Priscilla Walmsley - 29 Nov 2004 22:47 GMT
Hi Jeffry,
> I think to point is, which I didn't know and you made perfectly clear,
> that if an element extends a type, it now has an anonymous type that
> extends from that type. And that's what causes all the confusion. Right? I
> hope so :)
Exactly!
Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com
------------------------------------------------------------------