lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] change file formats to XML


From: Vaclav Slavik
Subject: Re: [lmi] change file formats to XML
Date: Tue, 09 Mar 2010 18:53:50 +0100

On Mon, 2010-03-08 at 16:25 +0100, Vaclav Slavik wrote:
> I'd argue it is: I'd expect xml::node(xml::node::text("M&E")) to write
> "M&E" into the file. Or maybe throw, but certainly not write "M"
> silently and pretend everything is fine. I have similar expectation from
> xml::node::set_content(), but that one may be less clear.

Turns out that this behavior of set_content() is intentional. I'll add a
replacement in xmlwrapp 0.7; for now, please replace the two occurrences
of set_content() in my patch with direct inclusion of text node:

diff --git a/xml_serialize.hpp b/xml_serialize.hpp
index 82beccf..9fbd575 100644
--- a/xml_serialize.hpp
+++ b/xml_serialize.hpp
@@ -78,7 +78,7 @@ namespace xml_serialize
             s << in;
             if(!s.good())
                 throw std::runtime_error("Failure to serialize data into 
XML.");
-            out.set_content(s.str().c_str());
+            out.push_back(xml::node(xml::node::text(s.str().c_str())));
         }
 
         // reads value from nodes under node 'in' into 'out'
@@ -100,7 +100,7 @@ namespace xml_serialize
     {
         static void to_xml(xml::node& out, std::string const& in)
         {
-            out.set_content(in.c_str());
+            out.push_back(xml::node(xml::node::text(in.c_str())));
         }
 
         static void from_xml(std::string& out, xml::node const& in)

Thanks,
Vaclav





reply via email to

[Prev in Thread] Current Thread [Next in Thread]