[Boost-bugs] [Boost C++ Libraries] #8566: Enable writing of CDATA

Subject: [Boost-bugs] [Boost C++ Libraries] #8566: Enable writing of CDATA
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-13 14:28:46


#8566: Enable writing of CDATA
----------------------------------------------------------------+-----------
 Reporter: Wolf A. Heidrich <wolf.heidrich@…> | Owner: cornedbee
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: property_tree
  Version: | Severity: Problem
 Keywords: |
----------------------------------------------------------------+-----------
 If one tries to write a node using write_xml

 <example><![CDATA[<>]]></example>

 the characters <> (and probably & etc.) get escaped in HTML style. The
 output file will contain

 <example>&lt;![CDATA[&lt;&gt;]]&gt;</example>

 Might it be a solution to introduce another sub-key <xmlcdata> (like
 <xmlcomment>) and write code analogue to function write_xml_comment like
 {{{
     template<class Ch>
     void write_xml_xcdata(std::basic_ostream<Ch> &stream,
                            const std::basic_string<Ch> &s,
                            int indent,
                            bool separate_line,
                            const xml_writer_settings<Ch> & settings
                            )
     {
         typedef typename std::basic_string<Ch> Str;
         if (separate_line)
             write_xml_indent(stream,indent,settings);
         stream << Ch('<') << Ch('!') << Ch('[') << Ch('C') << Ch('D') <<
 Ch('A') << Ch('T') << Ch('A') << Ch('[');
         stream << s;
         stream << Ch(']') << Ch(']') << Ch('>');
         if (separate_line)
             stream << Ch('\n');
     }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8566>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC