#define PARSE_OPTIONS 0
#endif
+PRSS* prss_parse_doc(xmlDocPtr doc);
+
PRSS* prss_parse_data(const char* xml_data)
{
xmlDocPtr doc = xmlReadMemory(xml_data, strlen(xml_data), "", NULL, PARSE_OPTIONS);
PRSS* prss_parse_doc(xmlDocPtr doc)
{
+ // FIXME: doc shouldn't be freed after failure when called explicitly from program!
+
xmlNodePtr root = xmlDocGetRootElement(doc);
PRSS* result = malloc(sizeof(PRSS));
prss_null(result);
// RSS 1.0 document
if (!parse_rss_1_0(result, root)) {
free(result);
+ xmlFreeDoc(doc);
return NULL;
}
return result;
// RSS 2.0 or <1.0 document
if (!parse_rss_2_0(result, root)) {
free(result);
+ xmlFreeDoc(doc);
return NULL;
}
return result;