[xsd-users] "flushing" xml object tree into xml file - please
advise
Boris Kolpackov
boris at codesynthesis.com
Wed May 9 09:05:52 EDT 2007
Hi Uri,
Thanks for remembering to post your question to xsd-users.
Uri Karagila <uri at hyperroll.com> writes:
> In case my xml tree is fully loaded, how can I "flush" it into file.xml?
>
> Can you please point to relevant documentation or provide useful
> example.
First of all you will need to compile your schemas with the
--generate-serialization option in order to generate the serialization
code. The library example (in examples/cxx/tree) shows how to write the
tree to stdout (std::cout object). In order to write it to a file, you
can replace this line:
catalog_ (std::cout, *c, map);
with something like this:
std::ofstream ofs ("file.xml");
catalog_ (ofs, *c, map);
(You will also need to add #include <fstream> at the beginning).
For more information on serializing the in-memory representation to XML,
refer to Chapter 4, "Serialization", of the C++/Tree Mapping User Manual:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#4
hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070509/972790d2/attachment.pgp
More information about the xsd-users
mailing list