From 7779e6a74852a7655210abb686287a4b59e75fdc Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 19 Sep 2020 16:35:33 +0200 Subject: XML cdata callback: handle CDATA as data This improves handling CDATA for example in Atom feeds with: --- sfeed.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sfeed.c b/sfeed.c index 328ecec..ecc28ce 100644 --- a/sfeed.c +++ b/sfeed.c @@ -111,7 +111,6 @@ static void xmlattrend(XMLParser *, const char *, size_t, const char *, size_t); static void xmlattrstart(XMLParser *, const char *, size_t, const char *, size_t); -static void xmlcdata(XMLParser *, const char *, size_t); static void xmldata(XMLParser *, const char *, size_t); static void xmldataentity(XMLParser *, const char *, size_t); static void xmltagend(XMLParser *, const char *, size_t, int); @@ -718,15 +717,6 @@ xmlattrstart(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl) xmldata(p, "=\"", 2); } -static void -xmlcdata(XMLParser *p, const char *s, size_t len) -{ - if (!ctx.field) - return; - - string_append(ctx.field, s, len); -} - /* NOTE: this handler can be called multiple times if the data in this * block is bigger than the buffer. */ static void @@ -924,7 +914,7 @@ main(int argc, char *argv[]) parser.xmlattrentity = xmlattrentity; parser.xmlattrend = xmlattrend; parser.xmlattrstart = xmlattrstart; - parser.xmlcdata = xmlcdata; + parser.xmlcdata = xmldata; parser.xmldata = xmldata; parser.xmldataentity = xmldataentity; parser.xmltagend = xmltagend; -- cgit v1.2.3