diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2011-09-08 14:27:40 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2011-09-08 14:27:40 +0000 |
| commit | 8a73582fd88bffa4e219dfce758a930b43c06a98 (patch) | |
| tree | 625d3418f77eb5db1aa913f522773ed0f4bd4f55 /src/xml/repr-io.cpp | |
| parent | Obey to dont-scale-strokewidth preference, even when scaling one dimension to... (diff) | |
| download | inkscape-8a73582fd88bffa4e219dfce758a930b43c06a98.tar.gz inkscape-8a73582fd88bffa4e219dfce758a930b43c06a98.zip | |
Preserve CDATA sections on output.
(bzr r10625)
Diffstat (limited to 'src/xml/repr-io.cpp')
| -rw-r--r-- | src/xml/repr-io.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 2a0bb6ce8..365415488 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -24,6 +24,7 @@ #include "xml/attribute-record.h" #include "xml/rebase-hrefs.h" #include "xml/simple-document.h" +#include "xml/text-node.h" #include "io/sys.h" #include "io/uristream.h" @@ -497,7 +498,9 @@ sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ return NULL; // we do not preserve all-whitespace nodes unless we are asked to } - return xml_doc->createTextNode(reinterpret_cast<gchar *>(node->content)); + // We keep track of original node type so that CDATA sections are preserved on output. + return xml_doc->createTextNode(reinterpret_cast<gchar *>(node->content), + node->type == XML_CDATA_SECTION_NODE ); } if (node->type == XML_COMMENT_NODE) { @@ -849,7 +852,12 @@ void sp_repr_write_stream( Node *repr, Writer &out, gint indent_level, { switch (repr->type()) { case Inkscape::XML::TEXT_NODE: { - repr_quote_write( out, repr->content() ); + if( dynamic_cast<const Inkscape::XML::TextNode *>(repr)->is_CData() ) { + // Preserve CDATA sections, not converting '&' to &, etc. + out.printf( "<![CDATA[%s]]>", repr->content() ); + } else { + repr_quote_write( out, repr->content() ); + } break; } case Inkscape::XML::COMMENT_NODE: { |
