[xsd-users] Parsing and validation from CDR stream

Boris Kolpackov boris at codesynthesis.com
Tue Aug 24 10:25:28 EDT 2010


Hi Romain,

Romain <rc.mail.dev at gmail.com> writes:

> In the example given, you are using a boost::archive::text_oarchive 
> to serialize the data:
> 
> using namespace library;
> using boost::archive::text_oarchive;
> using boost::archive::text_iarchive;
> 
> // Read in the file
> std::auto_ptr<catalog> c (catalog_ (argv[1])));
> 
> cerr << *c << endl;
> 
> // Save into a text archive
> std::ostringstream ostr;
> text_oarchive oa (ostr);
> xml_schema::ostream<text_oarchive> os (oa);
> os << *c;
> 
>
> Since Boost serialization provides a binary_oarchive, I was wondering if it
> was possible to use this archive model with XSD?

Yes, you can use any Boost archive. To change the 'binary/boost' example
from using text archives to binary archives you will need to do the
following:

1. Change makefile/VC project to pass the following XSD options:

   --generate-insertion boost::archive::binary_oarchive
   --generate-extraction boost::archive::binary_iarchive

   Instead of the ones for text_?archive.

2. Change library-prologue.hxx to include binary archive Boost
   headers instead of text.

3. Change the driver.cxx code to use binary archives instead of
   text.

That's it.

Boris



More information about the xsd-users mailing list