summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b703a4b)
raw | patch | inline | side by side (parent: b703a4b)
author | speleo3 <speleo3@users.sourceforge.net> | |
Sun, 11 Jan 2009 19:37:52 +0000 (19:37 +0000) | ||
committer | speleo3 <speleo3@users.sourceforge.net> | |
Sun, 11 Jan 2009 19:37:52 +0000 (19:37 +0000) |
src/xml/repr-io.cpp | patch | blob | history |
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 371af729f999b4cf3c6d1895df05e2b0b29b43f9..913992c7216a26e2dad634595d5c299292794d44 100644 (file)
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
#include "io/stringstream.h"
#include "io/gzipstream.h"
+#include "extension/extension.h"
+
#include "preferences.h"
using Inkscape::IO::Writer;
namespace {
-void promote_to_svg_namespace(Node *repr) {
+void promote_to_namespace(Node *repr, const gchar *prefix) {
if ( repr->type() == Inkscape::XML::ELEMENT_NODE ) {
GQuark code = repr->code();
if (!qname_prefix(code).id()) {
- gchar *svg_name = g_strconcat("svg:", g_quark_to_string(code), NULL);
+ gchar *svg_name = g_strconcat(prefix, ":", g_quark_to_string(code), NULL);
repr->setCodeUnsafe(g_quark_from_string(svg_name));
g_free(svg_name);
}
for ( Node *child = sp_repr_children(repr) ; child ; child = sp_repr_next(child) ) {
- promote_to_svg_namespace(child);
+ promote_to_namespace(child, prefix);
}
}
}
}
if (root != NULL) {
- /* promote elements of SVG documents that don't use namespaces
- * into the SVG namespace */
- if ( default_ns && !strcmp(default_ns, SP_SVG_NS_URI)
- && !strcmp(root->name(), "svg") )
- {
- promote_to_svg_namespace(root);
+ /* promote elements of some XML documents that don't use namespaces
+ * into their default namespace */
+ if ( default_ns && !strchr(root->name(), ':') ) {
+ if ( !strcmp(default_ns, SP_SVG_NS_URI) )
+ promote_to_namespace(root, "svg");
+ if ( !strcmp(default_ns, INKSCAPE_EXTENSION_URI) )
+ promote_to_namespace(root, INKSCAPE_EXTENSION_NS_NC);
}
}