summaryrefslogtreecommitdiff
path: root/xml.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2018-08-21 20:13:20 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-08-21 21:21:03 +0200
commitc58600a2a7ee2081c644268fc40269fd2beee77c (patch)
treeb993ac06861ca4a1ad8cb667b510a3bc79971f2e /xml.c
parent4565334dfe44863c50bdae150e85efca65f9ab18 (diff)
xml: don't reset internal tagname when parsing non-tag types like CDATA
... this affects "tags" starting with < such as CDATA and processing instructions.
Diffstat (limited to 'xml.c')
-rw-r--r--xml.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xml.c b/xml.c
index 2efd930..83a54d9 100644
--- a/xml.c
+++ b/xml.c
@@ -332,8 +332,7 @@ xml_parse(XMLParser *x)
if (c == '<') { /* parse tag */
if ((c = x->getnext()) == EOF)
return;
- x->tag[0] = '\0';
- x->taglen = 0;
+
if (c == '!') { /* cdata and comments */
for (tagdatalen = 0; (c = x->getnext()) != EOF;) {
if (tagdatalen <= sizeof("[CDATA[") - 1) /* if (d < sizeof(x->data)) */
@@ -353,6 +352,9 @@ xml_parse(XMLParser *x)
}
}
} else {
+ x->tag[0] = '\0';
+ x->taglen = 0;
+
/* normal tag (open, short open, close), processing instruction. */
if (isspace(c))
while ((c = x->getnext()) != EOF && isspace(c))