[xsd-users] Serialization Methods For Polymorphic Types
Friess, Jason
jason.friess at lmco.com
Mon Oct 3 16:46:46 EDT 2011
Hi,
I have polymorphic types in several schemas that we are working with using CodeSynthesis XSD. I generated C++ code for these schemas using CodeSynthesis XSD (with the "--generate-serialization" option - which resulted in serialization methods for each of the global elements in my schemas). My problem is that I would like to be able to call 1 serialization method created for the parent type regardless of which of the child types I am handling. I don't want to have to first determine which child type I have and then have to call the corresponding serialization method.
For instance I want to be able to do the following:
xml_schema::namespace_infomap map;
std::ostringstream oss;
Parent_(oss, obj, map); // "Parent_" would be a serialization method generated for the element associated with the parent type,
//"obj" is an object which has a type which is one of the child types of the parent type
std::string xml(oss.str()); //"xml" is the resulting XML string
Is this possible? If so - will it result in XML that is appropriate for the child type?
Thanks,
Jason
More information about the xsd-users
mailing list