diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-09-19 16:35:33 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-10-09 11:25:15 +0200 |
commit | 7779e6a74852a7655210abb686287a4b59e75fdc (patch) | |
tree | dcbe2fd088879219592d35c75e39f6ba12020763 | |
parent | 5b130adb977ba0ba233ccc5b2bdfc6d6e37563dd (diff) |
XML cdata callback: handle CDATA as data
This improves handling CDATA for example in Atom feeds with:
<author><email><![CDATA[abc]]><name><![CDATA[[person]]></name></author>
-rw-r--r-- | sfeed.c | 12 |
1 files changed, 1 insertions, 11 deletions
@@ -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; |