/*
- Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
+ Copyright (C) 2009-2010 Dale Whittaker <dayul@users.sf.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
xmlFree (newtype);
}
-static gchar*
-atom_get_title (FeedParser* fparser)
-{
- const gchar* name;
-
- if (!(name = katze_item_get_name (fparser->item)))
- {
- gchar* type;
-
- type = (gchar*)xmlGetProp (fparser->node, BAD_CAST "type");
- if (type)
- {
- gchar* content = NULL;
-
- if (g_str_equal (type, "html") ||
- g_str_equal (type, "xhtml"))
- content = feed_get_element_markup (fparser);
-
- xmlFree (type);
-
- if (content)
- return content;
- }
- return feed_get_element_string (fparser);
- }
- return g_strdup (name);
-}
-
static void
atom_preparse_entry (FeedParser* fparser)
{
}
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
{
- content = atom_get_title (fparser);
+ content = feed_get_element_string (fparser);
katze_item_set_name (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "summary"))
{
- content = feed_get_element_string (fparser);
+ content = feed_get_element_markup (fparser);
katze_item_set_text (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "updated"))
/* Only retrieve content if there is no summary */
if (!katze_item_get_text (fparser->item))
{
- content = feed_get_element_string (fparser);
+ content = feed_get_element_markup (fparser);
katze_item_set_text (fparser->item, content);
}
}
}
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
{
- content = atom_get_title (fparser);
+ content = feed_get_element_string (fparser);
katze_item_set_name (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "subtitle"))
{
- content = feed_get_element_string (fparser);
+ content = feed_get_element_markup (fparser);
katze_item_set_text (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "updated"))
#include <time.h>
gchar*
-feed_get_element_string (FeedParser* fparser)
+feed_get_element_markup (FeedParser* fparser)
{
xmlNodePtr node;
node = fparser->node;
+ if (node->children &&
+ !xmlIsBlankNode (node->children) &&
+ node->children->type == XML_ELEMENT_NODE)
+ {
+ return ((gchar*) xmlNodeGetContent (node->children));
+ }
+
if (!node->children ||
xmlIsBlankNode (node->children) ||
(node->children->type != XML_TEXT_NODE &&
}
gchar*
-feed_get_element_markup (FeedParser* fparser)
+feed_get_element_string (FeedParser* fparser)
{
gchar* markup;
- xmlNodePtr node = fparser->node;
-
- if (node->children &&
- !xmlIsBlankNode (node->children) &&
- node->children->type == XML_ELEMENT_NODE)
- {
- return (gchar*) xmlNodeGetContent (node->children);
- }
- markup = feed_get_element_string (fparser);
+ markup = feed_get_element_markup (fparser);
return feed_remove_markup (markup);
}
/*
- Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
+ Copyright (C) 2009-2010 Dale Whittaker <dayul@users.sf.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
}
else if (!xmlStrcmp (node->name, BAD_CAST "title"))
{
- content = feed_get_element_markup (fparser);
+ content = feed_get_element_string (fparser);
katze_item_set_name (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "description"))
{
- content = feed_get_element_string (fparser);
+ content = feed_get_element_markup (fparser);
katze_item_set_text (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "pubDate"))
if (!xmlStrcmp (node->name, BAD_CAST "title"))
{
- content = feed_get_element_markup (fparser);
+ content = feed_get_element_string (fparser);
katze_item_set_name (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "description"))
{
- content = feed_get_element_string (fparser);
+ content = feed_get_element_markup (fparser);
katze_item_set_text (fparser->item, content);
}
else if (!xmlStrcmp (node->name, BAD_CAST "lastBuildDate"))