summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-05-16 15:54:39 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-05-16 15:54:39 +0200
commit5c8840493f8cd52ba2224db6ed644f4933ac2212 (patch)
tree6a85eae1c06f34f7179664bdf31607c206980d56
parent0bb808b9bc9c673a086bcb3c5129b3b0691dd063 (diff)
xml: attrentity handler will be called if set
it used to be if attrentity is NULL it would call attrdata.
-rw-r--r--xml.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/xml.c b/xml.c
index 9f88792..d2a064d 100644
--- a/xml.c
+++ b/xml.c
@@ -82,7 +82,7 @@ xmlparser_parseattrs(XMLParser *x)
if(x->xmlattrstart)
x->xmlattrstart(x, x->tag, x->taglen, x->name, namelen);
for(valuelen = 0; (c = xmlparser_getnext(x)) != EOF;) {
- if(c == '&' && x->xmlattrentity) { /* entities */
+ if(c == '&') { /* entities */
x->data[valuelen] = '\0';
/* call data function with data before entity if there is data */
if(valuelen && x->xmlattr)
@@ -104,7 +104,8 @@ xmlparser_parseattrs(XMLParser *x)
}
if(c == ';') {
x->data[valuelen] = '\0';
- x->xmlattrentity(x, x->tag, x->taglen, x->name, namelen, x->data, valuelen);
+ if(x->xmlattrentity)
+ x->xmlattrentity(x, x->tag, x->taglen, x->name, namelen, x->data, valuelen);
valuelen = 0;
break;
}
@@ -310,7 +311,7 @@ xmlparser_parse(XMLParser *x)
if(x->xmldatastart)
x->xmldatastart(x);
while((c = xmlparser_getnext(x)) != EOF) {
- if(c == '&' && x->xmldataentity) {
+ if(c == '&') {
if(datalen) {
x->data[datalen] = '\0';
x->xmldata(x, x->data, datalen);
@@ -326,7 +327,8 @@ xmlparser_parse(XMLParser *x)
break;
else if(c == ';') {
x->data[datalen] = '\0';
- x->xmldataentity(x, x->data, datalen);
+ if(x->xmldataentity)
+ x->xmldataentity(x, x->data, datalen);
datalen = 0;
break;
}