Boost logo

Boost :

From: Russell Balest (russell_at_[hidden])
Date: 2004-06-04 17:24:03


Robert Ramey wrote:

>Russell Balest wrote
>
>
>
>>My request is support for xml <!-- comments --> in the serialization
>>xml archive. I believe it currently chokes if I add a comment in an xml
>>archive.
>>
>>
>
>
>
>>The application is for QA to compose test objects in xml and then
>>read them into applications with boost serialization.
>>It would be nice to annotate the test object 'templates' with comments
>>so QA can know what values are valid.
>>
>>
>
>
>
>>Does someone know where in the code I can implement this easily.
>>I just want to ignore the comments.
>>
>>
>
>Hmmm - my question is: What program is generating the XML archive in the
>first place?
>
     It's generated by the boost serialization library. At that point,
we effectively have an XML configuration file that is used as an input
to another program, again via boost serialization. Think of something
like the Apache config file if you're familiar with it. The main reason
I was drawn to the boost serialization is that a QA person will be able
to edit this XML file with an editor and create new test configurations,
as long as they just change data and don't mess with the schema. Since
it's now basically being viewed as a configuration file, comments would
of course be nice.
     The data structures I'm dealing with typically contain 10 or 30 C++
classes and can be 3-5 layers deep in nesting. They're very big and
it's too labor intensive for a QA'er (apparently) to compose them in C++
code. We also have a hundred different data structures of this type.
They want this ability.

>
>On the other hand, if the original XML archive is generated by the
>serialization library and just modified with comments, your request is very
>easy to accommodate. Just create a use the following in your serialize
>functions:
>
>Template<class Archive>
>Void serialize(Archive, my_class & t){
> std::string comment;
> ar & BOOST_NVP("comment", comment);
> ar & BOOST_NVP("myclass_data", t);;
>}
>
>In which case your XML output will look like:
>
>...
><comment></comment>
><myclass_data>..contents of t</myclass_data>
>...
>
>
>
     Good idea. I'll probably do that.

>After the archive is created you can edit the space between
><comment> and </comment> with anything you want - it would be just thrown
>away. Generally I wouldn't encourage the practice of editing an archive but
>in this circumstance I could see it as an acceptable practice.
>
>But then this raises the question if the comments are so important, why are
>they being thrown them away? Shouldn't they be data read by the program?
>
>
     The same data structures are being used in 2 separate contexts:
the production system sends binary data around and doesn't care about
comments or xml, but the development environment is migrating to use xml
and involve QA more. A side note - the serialization itself is not
being tested in this case. What's being tested is the behavior of the
programs when they receive various ranges of data or combinations of
(maybe internally inconsistent) data.

   Thanks for the suggestion,
   Russell

>Robert Ramey
>
>
>
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk