From d437851688283ae4024e8dc174afcfab2e340301 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 28 Oct 2017 07:25:15 +0200 Subject: 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. --- src/xml/repr-io.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/xml') 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++) -- cgit v1.2.3