id summary reporter owner description type status milestone component version severity resolution keywords cc
10338 Boost.PropertyTree update to v1.56 breaks existing code Pieter Sebastian Redl "Commit 4e7aa973f95b7151282ebcb77dd4cb9316fe920c (""Escape newlines and tabs in content when writing XML."") has broken my code.
Under certain circumstances, write_xml now produces an XML that starts with:
\n
- 0
which cannot be parsed by read_xml (an exception is thrown). Version 1.55 did not have this issue as it did not produce the escape sequence that read_xml chokes on.
Below I have included a unit test that reproduces the problem.
BOOST_AUTO_TEST_CASE(ReadAndWriteWithSpecialCharacters)
{
using boost::property_tree::ptree;
// the xml that will be turned into a ptree. Note the linefeed between Level_1 and Level_2 tags
std::string XmlString = ""\n- 0
"";
std::stringstream StringStream1(XmlString);
std::stringstream StringStream2;
// read the xml string
ptree Level1Tree;
read_xml(StringStream1,Level1Tree);
// write the sub-tree at level 1 to string stream 2 as an xml
ptree Level2Tree = Level1Tree.get_child(""Level_1"");
write_xml(StringStream2,Level2Tree);
// show that the xml string has an xml declaration followed by \n
(boost version 1.56)
// or an xml declaration followed by \n\n (boost version 1.55 and earlier)
std::string Level2XmlString = StringStream2.str();
if (BOOST_VERSION >= 105600)
{
BOOST_CHECK(Level2XmlString == ""\n
- 0
"");
}
else
{
BOOST_CHECK(Level2XmlString == ""\n\n- 0
"");
}
// reading the xml from string stream 2 throws an exception in boost 1.56 but not in boost 1.55
ptree OutputTree;
BOOST_CHECK_NO_THROW(read_xml(StringStream2,OutputTree));
}
" Bugs closed To Be Determined property_tree Boost 1.56.0 Regression fixed Escape sequence problem