if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
{
g_message ("Message GET: success (%d).", msg->status_code);
+
+ priv->xdoc = xmlParseDoc ((const xmlChar *)msg->response_body->data);
+ if (priv->xdoc == NULL)
+ {
+ g_warning ("Unable to parse xml.");
+ g_object_unref (service);
+ service = NULL;
+ }
+ else
+ {
+ priv->xroot = xmlDocGetRootElement (priv->xdoc);
+ }
}
else
{
- g_message ("Message GET: error (%d).", msg->status_code);
+ g_warning ("Message GET: error (%d): %s.",
+ msg->status_code,
+ msg->reason_phrase);
+ g_object_unref (service);
+ service = NULL;
}
return service;
xmlDoc
*gapp_service_get_xml_doc (GappService *service)
{
- xmlNode *xnode;
- GList *lst;
-
GappServicePrivate *priv = GAPP_SERVICE_GET_PRIVATE (service);
- xmlDoc *xdoc = xmlNewDoc ((const xmlChar *)"1.0");
- xmlNode *xroot = xmlNewNode (NULL, (const xmlChar *)"feed");
-
- /* adding root element */
- if (xroot == NULL) return NULL;
-
- xmlNewNs (xroot, (const xmlChar *)"http://www.w3.org/2005/Atom", NULL);
- xmlDocSetRootElement (xdoc, xroot);
-
- return xdoc;
+ return priv->xdoc;
}
/**