id summary reporter owner description type status milestone component version severity resolution keywords cc 4809 deserialization with xml_iarchive fails when attributes of top level element are reordered Kolja Nowak Bryce Adelstein Lelbach "Citing from [http://www.w3.org/TR/2008/REC-xml-20081126/ W3C XML spec], section 3.1: ""Note that the order of attribute specifications in a start-tag or empty-element tag is not significant."" The parser used by xml_iarchive doesn't conform to this, because it fails on XML input which is logically equivalent to the output of xml_oarchive, just because the attribute order of the top level element 'boost_serialization' was changed. In contrast, the parser seems to be robust against reordering attributes in other elements. The following program demonstrates the issue: {{{ #include #include #include #include void f(const std::string& xml) { try { std::string str; boost::archive::xml_iarchive(std::istringstream(xml)) >> boost::serialization::make_nvp(""str"", str); std::cout << str << std::endl; } catch(boost::archive::archive_exception& e) { std::cout << e.what() << std::endl; } } int main() { // deserialize some xml, which was created using xml_oarchive f("""" """" """" ""deserialize successfull"" """"); // the same xml, but attributes of reorderd f("""" """" """" ""deserialize successfull"" """"); return 0; } }}} The following patch to basic_xml_grammar.ipp modifies the rule 'SerializationWrapper' to accept both possible combinations: {{{ Index: libs/serialization/src/basic_xml_grammar.ipp =================================================================== --- libs/serialization/src/basic_xml_grammar.ipp (revision 66354) +++ libs/serialization/src/basic_xml_grammar.ipp (working copy) @@ -271,9 +271,9 @@ = -S >> ""> S - >> SignatureAttribute - >> S - >> VersionAttribute + >> ( (SignatureAttribute >> S >> VersionAttribute) + | (VersionAttribute >> S >> SignatureAttribute) + ) >> !S >> '>' ; }}} " Bugs closed To Be Determined serialization Boost 1.44.0 Problem fixed serialization xml attribute order