How to override the init() in the xml serialization library..

Hi,
I have a need to be able to specify my own init routine for the xml
serialization. I tried deriving a new archive from xml_oarchive_impl and
tried to have a init() function there but that does not get invoked.
I am using boost serialization library ver 1.32.
The xml that is generated by the library is malformed. It generates the
following line without corresponding end tag

A couple of things:
a) you might try opening the the archive with the "no_header" flag.
b) I checked the output of my tests and I see that they do contain the end tag
. You might try running one of tests and/or demos
to verify that these work on your system. If they do, investigate what your
program is doing differently
c) I looked in the code in "basic_xml_oarchive.ipp" and it does contain code
to append at the end of the output. You should
investigate why this code isn't being called. If this is due to an error
in the library- we would be interested in the details.
Robert Ramey
"Sangeeta Singh"

Thanks,
I could get past the header with the "no_header" flag. Also I tried the
demo and it puts the tag correctly but I do not
get that tag in my case.
Does the friend declaration for the stream << operators required in the
classes that implement serialization. I do not have this declaration but
it seems to work fine.
The other thing is that I get the xml from outside source and when
reading in it might have a header which will be different from the one
boost has.
That was the reason I wanted to overwrite the init function to have
custom header. Now I generate o/p with no header but then still have to
read in the header. The only other way is I eat the header. Is there
some cleaner?
But at least I know a way around. Thanks fro your time and help.
Thanks,
Sangeeta
________________________________
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert Ramey
Sent: Tuesday, May 27, 2008 9:10 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] How to override the init() in the
xmlserializationlibrary..
A couple of things:
a) you might try opening the the archive with the "no_header" flag.
b) I checked the output of my tests and I see that they do contain the
end tag
. You might try running one of tests and/or demos
to verify that these work on your system. If they do, investigate what
your
program is doing differently
c) I looked in the code in "basic_xml_oarchive.ipp" and it does contain
code
to append at the end of the output. You should
investigate why this code isn't being called. If this is due to an
error
in the library- we would be interested in the details.
Robert Ramey
"Sangeeta Singh"

One more thing. You might be closing the stream before the xml_archive is destroyed. This is a common mistake.
Robert Ramey
"Sangeeta Singh"

Hi,
The end tag gets written when I use a file as the
outputstream. When I use a string as the outputstream I do not get this
tag even if I flush the stream. Probably some problem with the
oStringStream. Flush or adding a endl also does not work.
Thanks,
Sangeeta
________________________________
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert Ramey
Sent: Tuesday, May 27, 2008 9:10 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] How to override the init() in the
xmlserializationlibrary..
A couple of things:
a) you might try opening the the archive with the "no_header" flag.
b) I checked the output of my tests and I see that they do contain the
end tag
. You might try running one of tests and/or demos
to verify that these work on your system. If they do, investigate what
your
program is doing differently
c) I looked in the code in "basic_xml_oarchive.ipp" and it does contain
code
to append at the end of the output. You should
investigate why this code isn't being called. If this is due to an
error
in the library- we would be interested in the details.
Robert Ramey
"Sangeeta Singh"

Sangeeta Singh wrote:
Hi,
The end tag gets written when I use a file as the outputstream. When I use a string as the outputstream I do not get this tag even if I flush the stream. Probably some problem with the oStringStream. Flush or adding a endl also does not work.
How about ends? Jeff Flinn
participants (3)
-
Jeff Flinn
-
Robert Ramey
-
Sangeeta Singh