I'm using this great tool (http://www.codesynthesis.com/products/xsd/c++/tree/) to convert xsd into c++ code.
I'm trying to obtain the xml string from a sub node, but the only thing that i can get is the all xml, like this:
the all xml:
<?xml version="1.0"?>
<people ....>
<person id="1">
<first-name>John</first-name>
<address>
....
</address>
</person>
...
I can get the all xml doing something like this:
people_t& p = ...
xml_schema::namespace_infomap map;
map[""].schema = "people.xsd";
// Serialize to a string.
//
std::ostringstream oss;
people (oss, p, map);
std::string xml (oss.str ());
But what i want is to get only the < address > xml sub node for example. This is possible to do? how can be accomplished?
Thanks
If I understand what you're asking, I think you want to use the no_xml_declaration flag.
This suppresses the XML declaration, though for some versions of Xerces-C it results in a spurious newline at the beginning which you'll need to remove. http://www.codesynthesis.com/pipermail/xsd-users/2009-December/002625.html
For anyone else referencing this question later, you also need to invoke xsdcxx with --generate-serialization. By default only parse methods are emitted.