[xsd-users] Multiple schemas with the same namespace, compiled into a library

Boris Kolpackov boris at codesynthesis.com
Mon Apr 8 10:29:22 EDT 2013


Hi Tony,

Tony McConnell <amnw14545 at googlemail.com> writes:

> However, I get a strange message: type '' is not derived from ''

I took a look at your test and I see your schemas use polymorphism.
The problem is that there is only one map that maps type names (as
appear in xsi:type in your XML documents) to C++ types that will be
instantiated.


> If my object files are linked into the library in order t1.o, t2.o, I get
> the error when parsing t2.xml
> 
> If my object files are linked into the library in order t2.o t1.o, I get
> the error when parsing t1.xml

The link order determines which schema "wins" registering its type 
information in the above mentioned map. 


> Please could someone tell me what type '' is not derived from '' means?

This error means that a supposedly derived type is actually not derived
from the expected base. I am pretty sure it is caused by the "registration
race".

The XSD runtime actually has a mechanism for creating multiple set of
maps (called "plates"). It's just that the XSD compiler doesn't expose
this and always uses plate 0. If you would like, I can add an option to
the XSD compile to allow one to specify the plate number to use. With
this support you can then place each schema on its own plate, just like
you are already mapping them to their own C++ namespaces.

Boris



More information about the xsd-users mailing list