XML Schema equivClass.

Stefan Haustein haustein at ls8.cs.uni-dortmund.de
Thu Feb 3 09:36:37 GMT 2000


> <element name="A" type="Atype"/>
> 
> <element name="B" type="Btype"/>
> <type name="Btype" source="Atype" derivedBy="extension">
>    <element name="notimportant"/>
> </type>
> 
> <element name="C" >
>    <type>
>       <element ref="A"/>
>    </type>
> </element>
> 
> I now expect that it is okay to declare in the document instance:
> <C>
>   <B> B stuff in here </B>
> </C>

If I read the specs right, you can write

<C>
  <A xsi:type="Btype"> B stuff in here </A>
</C>

I don't like it. I don't like the distinction between "type" and
"element" at all. In OOP, you have mainly classes and instances, that's
it. Ok, you also may have primitive types and interfaces, but the
distinction between interfaces and classes is not relevant to XML since
there are no methods at all. 

XML schema (structure part) looks like trying to have full compatibility
to both, DTDs and OOP features. Look at C++ and know where that
ends....  BTW, a similar problem exists in C++:

consider class A, class B extends A

you cannot assign an instance of B to an A variable because it may
consume more memory and thus not fit... So you need explicit pointers to
make really use of inheritance. But with pointers, you cannot really use
the STL (no wonder if you read what the STL author thinks of OOP). So
you also need some wrapper classes....

Best regards

Stefan

-- 
Dipl.-Inform. Stefan Haustein
University of Dortmund
Computer Science VIII
www-ai.cs.uni-dortmund.de

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions and unsubscriptions
are  now ***CLOSED*** in preparation for list transfer to OASIS.





More information about the Xml-dev mailing list