Subject: [Boost-bugs] [Boost C++ Libraries] #12438: Wrong additional closing tag in boost::archive::xml_woarchive
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-09-05 12:23:39
#12438: Wrong additional closing tag in boost::archive::xml_woarchive
------------------------------+---------------------------
Reporter: anonymous | Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.62.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------
boost::archive::xml_woarchive writes an additional line
'''</boost_serialization>'''
after the closing tag
'''</boost_serialization>'''
The output of boost::archive::xml_oarchive is correct.
The ouput of xml_woarchive is
{{{
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="14">
<w_foo class_id="0" tracking_level="0" version="0"></w_foo>
</boost_serialization>
</boost_serialization>
}}}
The source code is
{{{
// Boost: 1.62.0 BETA1
//
// Toolset: Microsoft Visual C++
// Microsoft Visual Studio Professional 2015
// Version 14.0.25425.01 Update 3
// Visual C++ 2015 00325 - 60002 - 24764 - AA687
// Microsoft Visual C++ 2015
// Behavior is in all configurations 32bit/64bit and debug/release
//
// ====================================================================
// Needed for <boost/archive/tmpdir.hpp>
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <boost/archive/tmpdir.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_woarchive.hpp>
// ====================================================================
class foo
{
public:
foo() {};
template<class Archive>
void serialize(Archive &ar, const unsigned int version) {}
};
// --------------------------------------------------------------------
void save_sfoo(const foo& s_foo, const std::string& filename)
{
std::ofstream ofs(filename);
boost::archive::xml_oarchive oa(ofs);
oa << BOOST_SERIALIZATION_NVP(s_foo);
}
// --------------------------------------------------------------------
void save_wfoo(const foo& w_foo, const std::string& filename)
{
std::wofstream ofs(filename);
boost::archive::xml_woarchive oa(ofs);
oa << BOOST_SERIALIZATION_NVP(w_foo);
}
// ====================================================================
int main(int argc, char *argv[])
{
foo some_foo;
std::string savedir(boost::archive::tmpdir());
std::cout << "Saving s_foo.xml and w_foo.xml to directory <" << savedir
<< ">" << std::endl;
save_sfoo(some_foo, savedir + "/sfoo.xml");
save_wfoo(some_foo, savedir + "/wfoo.xml");
return 0;
}
// ====================================================================
// Files created are
// ====================================================================
// "sfoo.xml"
// --------------------------------------------------------------------
/*
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="14">
<s_foo class_id="0" tracking_level="0" version="0"></s_foo>
</boost_serialization>
*/
// --------------------------------------------------------------------
// "wfoo.xml"
// --------------------------------------------------------------------
/*
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="14">
<w_foo class_id="0" tracking_level="0" version="0"></w_foo>
</boost_serialization>
</boost_serialization>
*/
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12438> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC