Boost C++ Libraries: Ticket #12438: Wrong additional closing tag in boost::archive::xml_woarchive https://svn.boost.org/trac10/ticket/12438 <p> boost::archive::xml_woarchive writes an additional line <strong>&amp;lt;/boost_serialization&amp;gt;</strong> after the closing tag <strong>&lt;/boost_serialization&gt;</strong> The output of boost::archive::xml_oarchive is correct. </p> <p> The ouput of xml_woarchive is </p> <pre class="wiki">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes" ?&gt; &lt;!DOCTYPE boost_serialization&gt; &lt;boost_serialization signature="serialization::archive" version="14"&gt; &lt;w_foo class_id="0" tracking_level="0" version="0"&gt;&lt;/w_foo&gt; &lt;/boost_serialization&gt; &amp;lt;/boost_serialization&amp;gt; </pre><p> The source code is </p> <pre class="wiki">// 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 &lt;boost/archive/tmpdir.hpp&gt; #define _CRT_SECURE_NO_WARNINGS #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; #include &lt;boost/archive/tmpdir.hpp&gt; #include &lt;boost/archive/xml_oarchive.hpp&gt; #include &lt;boost/archive/xml_woarchive.hpp&gt; // ==================================================================== class foo { public: foo() {}; template&lt;class Archive&gt; void serialize(Archive &amp;ar, const unsigned int version) {} }; // -------------------------------------------------------------------- void save_sfoo(const foo&amp; s_foo, const std::string&amp; filename) { std::ofstream ofs(filename); boost::archive::xml_oarchive oa(ofs); oa &lt;&lt; BOOST_SERIALIZATION_NVP(s_foo); } // -------------------------------------------------------------------- void save_wfoo(const foo&amp; w_foo, const std::string&amp; filename) { std::wofstream ofs(filename); boost::archive::xml_woarchive oa(ofs); oa &lt;&lt; BOOST_SERIALIZATION_NVP(w_foo); } // ==================================================================== int main(int argc, char *argv[]) { foo some_foo; std::string savedir(boost::archive::tmpdir()); std::cout &lt;&lt; "Saving s_foo.xml and w_foo.xml to directory &lt;" &lt;&lt; savedir &lt;&lt; "&gt;" &lt;&lt; std::endl; save_sfoo(some_foo, savedir + "/sfoo.xml"); save_wfoo(some_foo, savedir + "/wfoo.xml"); return 0; } // ==================================================================== // Files created are // ==================================================================== // "sfoo.xml" // -------------------------------------------------------------------- /* &lt;?xml version="1.0" encoding="UTF-8" standalone="yes" ?&gt; &lt;!DOCTYPE boost_serialization&gt; &lt;boost_serialization signature="serialization::archive" version="14"&gt; &lt;s_foo class_id="0" tracking_level="0" version="0"&gt;&lt;/s_foo&gt; &lt;/boost_serialization&gt; */ // -------------------------------------------------------------------- // "wfoo.xml" // -------------------------------------------------------------------- /* &lt;?xml version="1.0" encoding="UTF-8" standalone="yes" ?&gt; &lt;!DOCTYPE boost_serialization&gt; &lt;boost_serialization signature="serialization::archive" version="14"&gt; &lt;w_foo class_id="0" tracking_level="0" version="0"&gt;&lt;/w_foo&gt; &lt;/boost_serialization&gt; &amp;lt;/boost_serialization&amp;gt; */ </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12438 Trac 1.4.3 Robert Ramey Tue, 01 Nov 2016 22:10:57 GMT <link>https://svn.boost.org/trac10/ticket/12438#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12438#comment:1</guid> <description> <p> this is clearly an error. I thought I fixed this in the final release of 1.61. Are you sure that you're not using one of pre-release betas? Does the issue still show up in the develop branch? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 02 Nov 2016 19:12:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12438#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12438#comment:2</guid> <description> <p> The reported error is Boost 1.62 release (when I reported the error Boost 1.62 beta was in use). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 02 Nov 2016 19:24:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12438#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12438#comment:3</guid> <description> <p> Did you upgrade to the 1.62 final? The log shows that a fix was checked into the master (32b2bda) on April 21,2016. Is this fix not in your code? or does the "fix" fail to address the issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 04 Nov 2016 16:22:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12438#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12438#comment:4</guid> <description> <p> The latest 1.62 release we upgraded to is the final one, it is not a beta. We loaded it from <a class="ext-link" href="https://sourceforge.net/projects/boost/files/boost-binaries/1.62.0/boost_1_62_0-bin-msvc-all-32-64.7z/download"><span class="icon">​</span>https://sourceforge.net/projects/boost/files/boost-binaries/1.62.0/boost_1_62_0-bin-msvc-all-32-64.7z/download</a> The timestamp is 2016-09-26. It has not been updated since then. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 03 May 2017 22:32:36 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12438#comment:5 https://svn.boost.org/trac10/ticket/12438#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I've just tested this on my version on the develop branch and it IS fixed there. </p> <p> I recently realized that due to an oversight on my part, some fixes on my local develop branch weren't merged and pushed. But I think that's fixed now. Unfortunately, this isn't in the latest release but it should be in the next one for sure. </p> <p> Robert Ramey </p> Ticket jaroslav.beran@… Wed, 05 Jul 2017 17:42:15 GMT <link>https://svn.boost.org/trac10/ticket/12438#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12438#comment:6</guid> <description> <p> I found same bug in version 1.62. I tried to use version 1.64 (downloaded from <a class="ext-link" href="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.7z"><span class="icon">​</span>https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.7z</a>) with same result (additional line). </p> <p> I've modified the file .\boost_1_64_0\boost\archive\impl\xml_woarchive_impl.ipp as shown below and it works fine for me now. </p> <p> #ifndef BOOST_NO_INTRINSIC_WCHAR_T<br /> template&lt;class Archive&gt;<br /> BOOST_WARCHIVE_DECL void<br /> xml_woarchive_impl&lt;Archive&gt;::save(const wchar_t * ws){<br /> </p> <blockquote> <p> os &lt;&lt; ws;<br /> </p> </blockquote> <p> /* next lines commented out to fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12438" title="#12438: Bugs: Wrong additional closing tag in boost::archive::xml_woarchive (closed: fixed)">#12438</a> Wrong additional closing tag in boost::archive::xml_woarchive */<br /> #if 0<br /> </p> <blockquote> <p> typedef iterators::xml_escape&lt;const wchar_t *&gt; xmbtows;<br /> std::copy(<br /> </p> <blockquote> <p> xmbtows(ws),<br /> xmbtows(ws + std::wcslen(ws)),<br /> boost::archive::iterators::ostream_iterator&lt;wchar_t&gt;(os)<br /> </p> </blockquote> <p> );<br /> </p> </blockquote> <p> #endif<br /> }<br /> </p> <p> #endif </p> </description> <category>Ticket</category> </item> </channel> </rss>