[xsd-users] serialization functions as members ?

Bradley Beddoes beddoes at intient.com
Tue Jan 9 04:30:31 EST 2007


Hi,
Is there any way to have serialization functions generated as members of 
the actual class of your XSD type?.

For example:

<xsd:element name="Name" type="NameType"/>

This would currently generate the serialisation functions as standalone 
function calls for example like this:

void
Name (std::ostream&,
       const NameType&,
       const xml_schema::namespace_infomap&,
       const string& encoding = "UTF-8",
       xml_schema::flags = 0);

I am trying to write a generic marshaller library (integrated with 
xerces and xml security) and generating the serialization stuff this way 
make it impossible for me to do this. Instead is it possible to have for 
example:

class NameType
{
	public:
		void serialize (std::ostream&,
       const xml_schema::namespace_infomap&,
       const string& encoding = "UTF-8",
       xml_schema::flags = 0);

	....
}

??

This would allow me to define a generic function such as:

MyMarshaller::Marshall(T xmlObj)

Which would be able to serialize any object it was instantiated to serve 
at runtime which would really help enormously.

regards,
Bradley

-- 
Bradley Beddoes
Lead Software Architect

Intient - "Open Source, Open Standards"




More information about the xsd-users mailing list