Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-07-23 19:00:02


Just make sure that the archive is closed BEFORE the stream - like this:

{
    std::ostream os
    {
        boost::archive::xml_oarchive(os)
        ....
    } // archive destructor writes endtag
} // stream destructor closes stream

Robert Ramey

Sangeeta Singh wrote:
> Hi,
>
> When I xml serialize an object to a stringstream i get the following
> output
> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
> <!DOCTYPE boost_serialization>
> <boost_serialization signature="serialization::archive" version="3">
> <bidResponse class_id="0" tracking_level="0" version="0">
> <oppId>69</oppId>
> <delay>0</delay>
> <bid class_id="1" tracking_level="0" version="0">
> <maxBid>5.3000002</maxBid>
> <minBid>5.3000002</minBid>
> <adBlob>adblob</adBlob>
> </bid>
> </bidResponse>
>
> As can be seen the end tag </boost_serialization> is missing. thi
> shappens even if I flush the stringstream.
>
> If i xml serialize to a text file I do not see this problem here is
> the o/p when I xml serialize to a text file
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
> <!DOCTYPE boost_serialization>
> <boost_serialization signature="serialization::archive" version="3">
> <bidRequest class_id="0" tracking_level="0" version="0">
> <oppId>34567889</oppId>
> </bidRequest>
> <bidRequest class_id="0" tracking_level="0" version="0">
> <oppId>44567889</oppId>
> </bidRequest>
> </boost_serialization>
>
> Any idea how to resolve this.
>
> Thanks,
> Sangeeta


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net