[serialization] skipping top node "<boost_serialization signature...>"

Good morning everyone I'd like to use boost::serialization for the generation of xml-files. The format of those files shall not be specific to or dependent of boost, i.e. I'd like boost to not write the root-node of "<boost_serialization signature="serialization::archive" version=...>". E.g., instead of <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="4"> <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene> </boost_serialization> I would prefer <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene> . I wonder if this is possible without tweakage of boost components (meaning that I would have to fork or write patches). I tried the serialization-documentation and google, but could not find appropriate information (or maybe I missed the right words). Best Regards Sebastian Mach http://picogen.org

It seems like "boost::archive::no_header" is the right flag to construct xml_[io]archive with, though I can't test this right now as I can't install boost on this box. 2009/8/26 Sebastian Mach <phresnel@googlemail.com>
Good morning everyone
I'd like to use boost::serialization for the generation of xml-files. The format of those files shall not be specific to or dependent of boost, i.e. I'd like boost to not write the root-node of "<boost_serialization signature="serialization::archive" version=...>".
E.g., instead of
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="4"> <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene> </boost_serialization>
I would prefer
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene>
. I wonder if this is possible without tweakage of boost components (meaning that I would have to fork or write patches). I tried the serialization-documentation and google, but could not find appropriate information (or maybe I missed the right words).
Best Regards
Sebastian Mach http://picogen.org

Passing boost::archive::no_header as the second parameter to xml_oarchive() yields the following file for given test: <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene> Unfortunately, "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>" is now missing, too. For now, I am really not sure if I will use this part of boost, though I admit the overall greatness of it. 2009/8/26 Sebastian Mach <phresnel@googlemail.com>
It seems like "boost::archive::no_header" is the right flag to construct xml_[io]archive with, though I can't test this right now as I can't install boost on this box.
2009/8/26 Sebastian Mach <phresnel@googlemail.com>
Good morning everyone
I'd like to use boost::serialization for the generation of xml-files. The format of those files shall not be specific to or dependent of boost, i.e. I'd like boost to not write the root-node of "<boost_serialization signature="serialization::archive" version=...>".
E.g., instead of
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="4"> <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene> </boost_serialization>
I would prefer
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene>
. I wonder if this is possible without tweakage of boost components (meaning that I would have to fork or write patches). I tried the serialization-documentation and google, but could not find appropriate information (or maybe I missed the right words).
Best Regards
Sebastian Mach http://picogen.org

On Aug 26, 2009, at 7:15 PM, Sebastian Mach wrote:
Passing boost::archive::no_header as the second parameter to xml_oarchive() yields the following file for given test:
<picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene>
Unfortunately, "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>" is now missing, too.
Can't you just write this to the file yourself?
For now, I am really not sure if I will use this part of boost, though I admit the overall greatness of it.

2009/8/27 Matthias Troyer <troyer@phys.ethz.ch>
On Aug 26, 2009, at 7:15 PM, Sebastian Mach wrote:
Passing boost::archive::no_header as the second parameter to
xml_oarchive() yields the following file for given test:
<picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene>
Unfortunately, "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>" is now missing, too.
Can't you just write this to the file yourself?
Of course, but it feels a little bit unclean. The other reason I did not mention (sorry, really bad wording from my side) is that xml in general does not feel dedicated enough to what I need, i.e. it's too verbose in the end (I have lots of 3d/4d-vectors and 4x4 matrices, complex recursive/cyclic/self referencing graphs, and so forth, and it should be human readable and writable). I think I will use a custom format that I already had in the past, and go use spirit once again to build a kiss-conformat serialization framework.

On Thu, Aug 27, 2009 at 2:48 AM, Sebastian Mach<phresnel@googlemail.com> wrote:
2009/8/27 Matthias Troyer <troyer@phys.ethz.ch>
On Aug 26, 2009, at 7:15 PM, Sebastian Mach wrote:
Passing boost::archive::no_header as the second parameter to xml_oarchive() yields the following file for given test:
<picogen-qt-scene class_id="0" tracking_level="0" version="0"> <comment>hello world!</comment> <fenum>two</fenum> </picogen-qt-scene>
Unfortunately, "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>" is now missing, too.
Can't you just write this to the file yourself?
Of course, but it feels a little bit unclean.
The other reason I did not mention (sorry, really bad wording from my side) is that xml in general does not feel dedicated enough to what I need, i.e. it's too verbose in the end (I have lots of 3d/4d-vectors and 4x4 matrices, complex recursive/cyclic/self referencing graphs, and so forth, and it should be human readable and writable).
I think I will use a custom format that I already had in the past, and go use spirit once again to build a kiss-conformat serialization framework.
Building and reading s-expressions are easy, and personally I think they are cleaner then XML.
participants (3)
-
Matthias Troyer
-
OvermindDL1
-
Sebastian Mach