[xsd-users] Sample code for GML creation?
Pavel Pohanka
pavelpgt at gmail.com
Wed Jul 21 13:15:02 EDT 2010
Hallo,
I would like to create a GML file in Visual Studio 2008 by means of XSD.
I have done a manual creation of *.cxx and *.hxx files according to
http://wiki.codesynthesis.com/Schemas/GML (GML 3.2.0)
xsd cxx-tree --generate-xml-schema --output-dir gen --options-file
common.options xml-schema.xsd
xsd cxx-tree --file-per-type --output-dir gen --options-file common.options
--options-file gml.options gml/3.2.1/gml.xsd
I put all created files and all gml schemas into a project, but I do not
know how to start creating an XML file.
Can you please provide me with an example code (driver.cxx) of how to start
to create an GML XML file.
Thanks a lot.
Pavel
PS: Hello example code works fine (driver.cxx file).
int
main (int argc, char* argv[])
{
try
{
hello_t h ("Hi");
hello_t::name_sequence& ns (h.name ());
ns.push_back ("Jane");
ns.push_back ("John");
ns.push_back ("John");
ns.push_back ("Pavel");
// Serialize the object model to XML.
//
xml_schema::namespace_infomap map;
map[""].name = "";
map[""].schema = "hello.xsd";
std::ofstream ofs (argv[1]);
hello (ofs, h, map);
}
catch (const xml_schema::exception& e)
{
cerr << e << endl;
return 1;
}
}
}
More information about the xsd-users
mailing list