0

I'm trying to save/load XML file use cereal, but can not figure out how to save/load XML attribute. For example:

I have a XML file:

<windows height="101", width = "200"/> 

and a struct

struct window
{
    int height;
    int width;
}

how can i define serialize function to load/save XML attribute value using cereal?

1 Answers1

0

cereal is not a general purpose XML parser. The XML archive that comes with cereal expects to be reading in XML that it itself generates, or at the very least XML in an identical format to what it expects.

For your example, cereal would expect as input:

<?xml version="1.0" encoding="utf-8"?>
<cereal>
    <windows>
        <height>101</height>
        <width>200</width>
    </windows>
</cereal>

To get the behavior you desire you would need to modify the XML archive or create your own archive.

Azoth
  • 1,652
  • 16
  • 24