[serialization] different behaviour between xml_wiarchive and binary_wiarchive

In my application I'm trying to serialize data alternatively to xml_wiarchive or binary_wiarchive. Writing and reading XML works without any problems. Binary writing seems to work too, but reading the file throws an exception with exception_code 'unregistered_class'. What I do is reading the XML data, writing binary and reading binary back in. I thought there should be no difference which kind of archive I use. Am I missing a point? I would be thankful for any hint. I know that it is hard to guess where the problem might be without seeing any code, but I by now I was not able to create some simple example which shows the same behaviour. I'm using Windows XP (SP2) with MSVC 8.0. Thanks. Oliver

Nachrichtall archives are meant to work alike.
binary_w?archive has not been maintained. It may or may not work. It
really has no reason for being as far as I can tell. The problem is that
the wide characters can included -1 which is confused with EOF. When I
discovered this, it didn't see a way to work around it and didn't really
understand how one could do binary i/o with wide character archives. I've
just assumed I've missed something dumb and moved on.
For practical purposes, just use binary_i/oarchive.
Robert Ramey
"Oliver Mutz"

Thanks for your answer Robert, Some of the files that did not work with binary_wiarchive are working now with binary_i/oarchive. Unfortunately some still don't. I'm trying to figure out what the reason for the trouble might be. The exception_code changed 'unregistered_class' to 'stream_error', because in some occasions the istream fails. Regards Oliver Robert Ramey wrote:
Nachrichtall archives are meant to work alike.
binary_w?archive has not been maintained. It may or may not work. It really has no reason for being as far as I can tell. The problem is that the wide characters can included -1 which is confused with EOF. When I discovered this, it didn't see a way to work around it and didn't really understand how one could do binary i/o with wide character archives. I've just assumed I've missed something dumb and moved on.
For practical purposes, just use binary_i/oarchive.
Robert Ramey "Oliver Mutz"
wrote in message news:008901c6d1cb$b896e1a0$150aa8c0@int.isdcad.de... In my application I'm trying to serialize data alternatively to xml_wiarchive or binary_wiarchive. Writing and reading XML works without any problems. Binary writing seems to work too, but reading the file throws an exception with exception_code 'unregistered_class'.
What I do is reading the XML data, writing binary and reading binary back in.
I thought there should be no difference which kind of archive I use. Am I missing a point?
*** Nope, it is a goal that all archives work alike.
I would be thankful for any hint.
I know that it is hard to guess where the problem might be without seeing any code, but I by now I was not able to create some simple example which shows the same behaviour.
I'm using Windows XP (SP2) with MSVC 8.0.
Thanks.
Oliver
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Its hard to know without seeing more code. Often there is a problem when load/save don't match up. The easiest way to verify this is make sure it works with xml_?archive which checks that the begin/end tags match. Other than that I don't know what to say. Robert Ramey Oliver Mutz wrote:
Thanks for your answer Robert,
Some of the files that did not work with binary_wiarchive are working now with binary_i/oarchive. Unfortunately some still don't. I'm trying to figure out what the reason for the trouble might be. The exception_code changed 'unregistered_class' to 'stream_error', because in some occasions the istream fails.
Regards
Oliver
Robert Ramey wrote:
Nachrichtall archives are meant to work alike.
binary_w?archive has not been maintained. It may or may not work. It really has no reason for being as far as I can tell. The problem is that the wide characters can included -1 which is confused with EOF. When I discovered this, it didn't see a way to work around it and didn't really understand how one could do binary i/o with wide character archives. I've just assumed I've missed something dumb and moved on.
For practical purposes, just use binary_i/oarchive.
Robert Ramey "Oliver Mutz"
wrote in message news:008901c6d1cb$b896e1a0$150aa8c0@int.isdcad.de... In my application I'm trying to serialize data alternatively to xml_wiarchive or binary_wiarchive. Writing and reading XML works without any problems. Binary writing seems to work too, but reading the file throws an exception with exception_code 'unregistered_class'.
What I do is reading the XML data, writing binary and reading binary back in.
I thought there should be no difference which kind of archive I use. Am I missing a point?
*** Nope, it is a goal that all archives work alike.
I would be thankful for any hint.
I know that it is hard to guess where the problem might be without seeing any code, but I by now I was not able to create some simple example which shows the same behaviour.
I'm using Windows XP (SP2) with MSVC 8.0.
Thanks.
Oliver
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

xml_?archive works perfectly fine. Thanks for that. The data I'm storing deals with some objects and rules between them. I found out that the serialization is breaking when handling nested rules (only binary_?archive). Right now I have spent a couple of hours debugging the depth of the serialization library in the failure case, but unfortunately I was not able to dig down to the orign of the error. If you would be willing to take a look at the code I could send it to you. I was able to condense it to a 200k zip file, but I am not sure if it is ok to send such a big attachement to the users list. Would it be allright to send it directly to you? Thanks Oliver Mutz
Other Robert Ramey wrote: Its hard to know without seeing more code. Often there is a problem when load/save don't match up. The easiest way to verify this is make sure it works with xml_?archive which checks that the begin/end tags match. Other than that I don't know what to say.
Robert Ramey
Oliver Mutz wrote:
Thanks for your answer Robert,
Some of the files that did not work with binary_wiarchive are working now with binary_i/oarchive. Unfortunately some still don't. I'm trying to figure out what the reason for the trouble might be. The exception_code changed 'unregistered_class' to 'stream_error', because in some occasions the istream fails.
Regards
Oliver
participants (2)
-
Oliver Mutz
-
Robert Ramey