[xsd-users] Controling the registration of the polymorphic types.

Boris Kolpackov boris at codesynthesis.com
Tue Nov 24 11:07:47 EST 2009


Hi Vladimir,

Vladimir Vasilyev <vladimir.vasilyev at mobile-mir.com> writes:

> How can i control the registration of the polymorphic types?

There is not much you can control at the moment. The types are
registered automatically during static initialization.


> I want to be able to register the type on demand (for instance when the
> dll is being loaded) and not by a static variable.

This will happen automatically with the current registration model.
On Windows if you have your type hierarchy spread over multiple DLLs
and/or executable, then you will need to export the polymorphic type
maps from the "base" DLL and import them from all the other DLLs and
the executable using the --export-maps/--import-maps options (see the
documentation for more information).

The only thing that is not supported in XSD 3.2.0 is de-registration
of the types when DLLs are unloaded. This has been fixed for the
next release of XSD and an update is available for XSD 3.2.0:

http://www.codesynthesis.com/~boris/tmp/xsd-3.2.0-map-unregister.zip


> How can i remove static variables and generate a [global] function with
> several calls to type_factory_map_instance.register_type?

There is no way to do this at the moment. It will also be difficult
to implement since there could be multiple schema files each of which
is translated to a separate C++ source file (or, in the file-per-type
mode, to multiple C++ files). So there is no way to provide a central
function which performs all the registration.

Can you explain why you want to do the registration manually?

Boris



More information about the xsd-users mailing list