Boost logo

Boost :

From: Drew Hohmann (drew_at_[hidden])
Date: 2007-11-14 10:26:14

I am saving multiple classes which contain STL collections, and in turn
those STL collections contain classes that contain more STL collections.
  A sample XML file follows.

The problem occurs when I try and move the XML file into a database, and
I receive the error "The table (item) cannot be the child table to
itself in nested relations."

In the collections_save_imp.hpp file, under the save_collection
function, the key line is
ar << boost::serialization::make_nvp("item", *it++);

I was thinking of instead of using the constant string "item" when
saving a STL collection, to keep track of the parent table name, and
modify the string based on the parent name. For example, under animals
item would be changed to "animals_item", under trials would be changed
to "trials_item", and under platforms would be changed to "platforms_item".

Is this the correct way to solve my problem, and if so does anyone have
any suggestions on how to implement it?

Drew Hohmann
Software Engineer

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="4">
<project class_id="0" tracking_level="0" version="1">
        <m_name>New Project</m_name>
        <animals class_id="1" tracking_level="0" version="0">
                <item class_id="2" tracking_level="0" version="1">
        <trials class_id="3" tracking_level="0" version="0">
                <item class_id="4" tracking_level="0" version="1">
                        <trialinfo class_id="5" tracking_level="0" version="1">
                                <platforms class_id="7" tracking_level="0" version="0">
                                        <item class_id="8" tracking_level="0" version="1">
                                                <circle class_id="9" tracking_level="0" version="1">

Boost list run by bdawes at, gregod at, cpdaniel at, john at