From 70d4b251462fd8237eeab440b4f16ca60de3e8b4 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Tue, 28 Oct 2014 11:13:59 +0200 Subject: Fix reading of CDATA elements If the element we are parsing is of type XML_CDATA_SECTION_NODE, we have to check the node's name from the parent. Fixes #718 Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- parse-xml.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'parse-xml.c') diff --git a/parse-xml.c b/parse-xml.c index 63ce64f86..fb5533708 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -1526,10 +1526,11 @@ static const char *nodename(xmlNode *node, char *buf, int len) int levels = 2; char *p = buf; - if (!node || !node->name) + if (node->type != XML_CDATA_SECTION_NODE && (!node || !node->name)) { return "root"; + } - if (node->parent && !strcmp(node->name, "text")) + if (node->type == XML_CDATA_SECTION_NODE || (node->parent && !strcmp(node->name, "text"))) node = node->parent; /* Make sure it's always NUL-terminated */ -- cgit v1.2.3-70-g09d2