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 <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2014-10-28 11:13:59 +02:00 committed by Dirk Hohndel
parent ee7c86f206
commit 70d4b25146

View file

@ -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 */