summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-10-28 05:25:15 +0000
committerTavmjong Bah <tavmjong@free.fr>2017-10-28 05:25:15 +0000
commitd437851688283ae4024e8dc174afcfab2e340301 (patch)
tree4dfc841c3bd9b1788d985b00ed7379897e4f3d90 /src/xml
parentProtect against missing "id". (diff)
downloadinkscape-d437851688283ae4024e8dc174afcfab2e340301.tar.gz
inkscape-d437851688283ae4024e8dc174afcfab2e340301.zip
Fix XML text parsing bug.
Since xml2 2.9.0, xmlNodeGetSpacePreserve() only checks element nodes, thus we need to check text node parent for xml:space value.
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/repr-io.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 725b313b1..2ff9d4776 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -561,7 +561,10 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc
return NULL; // empty text node
}
- bool preserve = (xmlNodeGetSpacePreserve (node) == 1);
+ // Since libxml2 2.9.0, only element nodes are checked, thus check parent.
+ // Note: this only handles XML's rules for white space. SVG's specific rules
+ // are handled in sp-string.cpp.
+ bool preserve = (xmlNodeGetSpacePreserve (node->parent) == 1);
xmlChar *p;
for (p = node->content; *p && g_ascii_isspace (*p) && !preserve; p++)