[xsd-users] get string of subtree

Boris Kolpackov boris at codesynthesis.com
Wed May 15 15:31:03 EDT 2013


Hi Adrian,

Adrian Stern <adrian.stern at screenfood.com> writes:

>  - Can I get the xml-string from a sub tree? (the important question is how)

Every XSD-generated class can be serialized into a DOMElement. So the
idea is to create a DOMDocument, serialize your sub-tree into it, and
finally serialize DOMDocument to string (using std::ostringstream).

An example that is the closest to what you are trying to do is 'messaging'.
In particular, it shows how to create a DOMDocument instance and how
to save it to std::ostream (the function that does that is in the
dom-serialize.?xx files). The only bit that will be different in
your case is the serialization of the sub-tree. It will look like
this:

const foo& f = ...; // Your sub-tree.
*doc->getDocumentElement () << x;


>  - Why does my IDE (qtcreator seem to be unable to show me any completion
> info on playlist_sequence (or other _sequences for that matter).

Probably because it cannot parse/understand the templates that are used
to implement sequences. Maybe upgrading to a more recent version will
help.

Boris



More information about the xsd-users mailing list