diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-10-28 11:13:59 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-28 07:25:29 -0700 |
commit | 70d4b251462fd8237eeab440b4f16ca60de3e8b4 (patch) | |
tree | ab3ff9d0b600aa7b6555f1bb702c4ab230ca5bc8 /parse-xml.c | |
parent | ee7c86f206f5465df0f0ade08b13da3b8062e67f (diff) | |
download | subsurface-70d4b251462fd8237eeab440b4f16ca60de3e8b4.tar.gz |
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>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 */ |