Boost C++ Libraries: Ticket #4738: property_tree parsers fail when top node has data() https://svn.boost.org/trac10/ticket/4738 <pre class="wiki">ptree tree( "DATA" ); write_xml( "test.xml", tree ); // writes out DATA with no tag read_xml( "test.xml", tree ); // fails since cannot read DATA without a tag. </pre><pre class="wiki">ptree pt1( "DATA" ); write_info( "test.info", tree ); // does not write DATA at all ptree pt2; read_info( "test.info", pt2 ); // reads in empty ptree BOOST_CHECK( pt1 == pt2 ); // fails since the node has no data </pre><hr /> <p> These could be easy fixes but some convention will have to be adopted. The info parser could be modified to write out the top level data when indent==-1 but the reader would then have to interpret an initial string with no following data or children to as data(). Alternatively there could be a null key represented by "" or some special character. </p> <p> The XML is trickier because the DATA either needs to be an attribute or needs some sort of tag, or it cannot be parsed as XML. </p> <p> I only checked this on the 1.43.0 that I have installed but it does not appear that the problem has been fixed in 1.44.0 or in subversion. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4738 Trac 1.4.3 Sebastian Redl Mon, 16 May 2011 18:55:50 GMT <link>https://svn.boost.org/trac10/ticket/4738#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4738#comment:1</guid> <description> <p> What this really should use is fail at write time for the XML interface. </p> </description> <category>Ticket</category> </item> </channel> </rss>