How to write an XML file from an XSD cxx tree object?

I am working with a library that uses XSD for creating objects from their XML-based format in C++.

Basically, the inheritance diagram looks something like this:

class BaseClass: public xsd::cxx::tree::type;
class MainXmlObject: public BaseClass;

I think I need to convert my MainXmlObject to a xerces::DOMDocument and then use DOMWriter to write the actual XML file, but I couldn't find the right routines so far.

What is the best way to do this?


It seems like adding the --add-serialization flag to the xsd code generation and then using something like:

xml_schema::namespace_infomap map;
//    map[""].name = "test"; // xmlns
//    map[""].schema = ""; // xsi:noNamespaceSchemaLocation
ofstream ofs(fname.c_str());
sbgn_(ofs, s, map); // invoking the stream here

works. References: Adding serialization and details from the XSD guide.

Need Your Help

Web Service Authentication using OpenID

web-services openid

I'm going to be developing a REST-ful Web Service for a new public website. The idea behind the web service is to have 3rd parties develop fully functional UIs for the business logic.

How to delete multiple list items in MVC?


I am trying to make an MVC4 application with EF database first, which i just started learning 2 days ago by myself.