+void rss_xml_start(void *data, const char *supplied_el, const char **attr)
+{
+ rss_xml_handler *h;
+ rss_aggregator *RSSAggr = (rss_aggregator*) data;
+ rss_item *ri = RSSAggr->Item;
+ void *pv;
+ const char *pel;
+ char *sep = NULL;
+
+ /* Axe the namespace, we don't care about it */
+ /*
+ syslog(LOG_DEBUG,
+ "RSS: supplied el %d: %s\n", RSSAggr->RSSAggr->ItemType, supplied_el);
+ */
+ pel = supplied_el;
+ while (sep = strchr(pel, ':'), sep) {
+ pel = sep + 1;
+ }
+
+ if (pel != supplied_el)
+ {
+ void *v;
+
+ if (!GetHash(KnownNameSpaces,
+ supplied_el,
+ pel - supplied_el - 1,
+ &v))
+ {
+ syslog(LOG_DEBUG,
+ "RSS: START ignoring "
+ "because of wrong namespace [%s]",
+ supplied_el
+ );
+ return;
+ }
+ }
+
+ StrBufPlain(RSSAggr->Key, pel, -1);
+ StrBufLowerCase(RSSAggr->Key);
+ if (GetHash(StartHandlers, SKEY(RSSAggr->Key), &pv))
+ {
+ h = (rss_xml_handler*) pv;
+
+ if (((h->Flags & RSS_UNSET) != 0) &&
+ (RSSAggr->ItemType == RSS_UNSET))
+ {
+ h->Handler(RSSAggr->CData, ri, RSSAggr, attr);
+ }
+ else if (((h->Flags & RSS_RSS) != 0) &&
+ (RSSAggr->ItemType == RSS_RSS))
+ {
+ h->Handler(RSSAggr->CData, ri, RSSAggr, attr);
+ }
+ else if (((h->Flags & RSS_ATOM) != 0) &&
+ (RSSAggr->ItemType == RSS_ATOM))
+ {
+ h->Handler(RSSAggr->CData,
+ ri,
+ RSSAggr,
+ attr);
+ }
+ else
+ syslog(LOG_DEBUG,
+ "RSS: START unhandled: [%s] [%s]...",
+ pel,
+ supplied_el
+ );
+ }
+ else
+ syslog(LOG_DEBUG,
+ "RSS: START unhandled: [%s] [%s]...",
+ pel,
+ supplied_el
+ );
+}
+
+void rss_xml_end(void *data, const char *supplied_el)
+{
+ rss_xml_handler *h;
+ rss_aggregator *RSSAggr = (rss_aggregator*) data;
+ rss_item *ri = RSSAggr->Item;
+ const char *pel;
+ char *sep = NULL;
+ void *pv;
+
+ /* Axe the namespace, we don't care about it */
+ pel = supplied_el;
+ while (sep = strchr(pel, ':'), sep) {
+ pel = sep + 1;
+ }
+ syslog(LOG_DEBUG, "RSS: END %s...", supplied_el);
+ if (pel != supplied_el)
+ {
+ void *v;
+
+ if (!GetHash(KnownNameSpaces,
+ supplied_el,
+ pel - supplied_el - 1,
+ &v))
+ {
+ syslog(LOG_DEBUG,
+ "RSS: END ignoring because of wrong namespace"
+ "[%s] = [%s]",
+ supplied_el,
+ ChrPtr(RSSAggr->CData));
+ FlushStrBuf(RSSAggr->CData);
+ return;
+ }
+ }
+
+ StrBufPlain(RSSAggr->Key, pel, -1);
+ StrBufLowerCase(RSSAggr->Key);
+ if (GetHash(EndHandlers, SKEY(RSSAggr->Key), &pv))
+ {
+ h = (rss_xml_handler*) pv;
+
+ if (((h->Flags & RSS_UNSET) != 0) &&
+ (RSSAggr->ItemType == RSS_UNSET))
+ {
+ h->Handler(RSSAggr->CData, ri, RSSAggr, NULL);
+ }
+ else if (((h->Flags & RSS_RSS) != 0) &&
+ (RSSAggr->ItemType == RSS_RSS))
+ {
+ h->Handler(RSSAggr->CData, ri, RSSAggr, NULL);
+ }
+ else if (((h->Flags & RSS_ATOM) != 0) &&
+ (RSSAggr->ItemType == RSS_ATOM))
+ {
+ h->Handler(RSSAggr->CData, ri, RSSAggr, NULL);
+ }
+ else
+ syslog(LOG_DEBUG,
+ "RSS: END unhandled: [%s] [%s] = [%s]...",
+ pel,
+ supplied_el,
+ ChrPtr(RSSAggr->CData));
+ }
+ else
+ syslog(LOG_DEBUG,
+ "RSS: END unhandled: [%s] [%s] = [%s]...",
+ pel,
+ supplied_el,
+ ChrPtr(RSSAggr->CData));
+ FlushStrBuf(RSSAggr->CData);
+}
+
+
+
+eNextState RSSAggregator_ParseReply(AsyncIO *IO)