[libgdata/gxml] * convert picasaweb to gxml



commit 0fe1ac0634d72dd899055ae3a8dd78f89d8bc8e0
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 23 15:36:39 2011 -0400

    * convert picasaweb to gxml

 gdata/services/picasaweb/gdata-picasaweb-album.c |   74 +++++++++++-----------
 gdata/services/picasaweb/gdata-picasaweb-feed.c  |   42 +++++++------
 gdata/services/picasaweb/gdata-picasaweb-file.c  |   54 ++++++++--------
 gdata/services/picasaweb/gdata-picasaweb-user.c  |   30 +++++----
 4 files changed, 104 insertions(+), 96 deletions(-)
---
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c b/gdata/services/picasaweb/gdata-picasaweb-album.c
index a5a93d0..8970f51 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-album.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-album.c
@@ -87,7 +87,7 @@
 #include <config.h>
 #include <glib.h>
 #include <glib/gi18n-lib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
 #include <string.h>
 
 #include "gdata-picasaweb-album.h"
@@ -106,7 +106,7 @@ static void gdata_picasaweb_album_finalize (GObject *object);
 static void gdata_picasaweb_album_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_picasaweb_album_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 static void get_xml (GDataParsable *parsable, GString *xml_string);
-static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error);
+static gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error);
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
 
 struct _GDataPicasaWebAlbumPrivate {
@@ -652,10 +652,12 @@ gdata_picasaweb_album_set_property (GObject *object, guint property_id, const GV
 }
 
 static gboolean
-parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
+parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error)
 {
 	gboolean success;
 	GDataPicasaWebAlbum *self = GDATA_PICASAWEB_ALBUM (parsable);
+	const gchar *node_name = gxml_dom_xnode_get_node_name (node);
+	GXmlDomElement *elem = GXML_DOM_ELEMENT (node);
 
 	/* TODO: media:group should also be P_NO_DUPES, but we can't, as priv->media_group has to be pre-populated
 	 * in order for things like gdata_picasaweb_album_get_tags() to work. */
@@ -677,80 +679,80 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
 		    gdata_parser_string_from_element (node, "id", P_REQUIRED | P_NON_EMPTY | P_NO_DUPES,
 		                                      &(self->priv->album_id), &success, error) == TRUE) {
 			return success;
-		} else if (xmlStrcmp (node->name, (xmlChar*) "access") == 0) {
+		} else if (g_strcmp0 (node_name, "access") == 0) {
 			/* gphoto:access */
-			xmlChar *access_level = xmlNodeListGetString (doc, node->children, TRUE);
-			if (xmlStrcmp (access_level, (xmlChar*) "public") == 0) {
+			gchar *access_level = gxml_dom_element_get_content (elem);
+			if (g_strcmp0 (access_level, "public") == 0) {
 				gdata_picasaweb_album_set_visibility (self, GDATA_PICASAWEB_PUBLIC);
-			} else if (xmlStrcmp (access_level, (xmlChar*) "private") == 0) {
+			} else if (g_strcmp0 (access_level, "private") == 0) {
 				gdata_picasaweb_album_set_visibility (self, GDATA_PICASAWEB_PRIVATE);
 			} else {
-				gdata_parser_error_unknown_content (node, (gchar*) access_level, error);
-				xmlFree (access_level);
+				gdata_parser_error_unknown_content (node, access_level, error);
+				g_free (access_level);
 				return FALSE;
 			}
-			xmlFree (access_level);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "timestamp") == 0) {
+			g_free (access_level);
+		} else if (g_strcmp0 (node_name, "timestamp") == 0) {
 			/* gphoto:timestamp */
-			xmlChar *timestamp_str;
+			gchar *timestamp_str;
 			guint64 milliseconds;
 
-			timestamp_str = xmlNodeListGetString (doc, node->children, TRUE);
-			milliseconds = g_ascii_strtoull ((gchar*) timestamp_str, NULL, 10);
-			xmlFree (timestamp_str);
+			timestamp_str = gxml_dom_element_get_content (elem);
+			milliseconds = g_ascii_strtoull (timestamp_str, NULL, 10);
+			g_free (timestamp_str);
 
 			gdata_picasaweb_album_set_timestamp (self, (gint64) milliseconds);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "numphotos") == 0) {
+		} else if (g_strcmp0 (node_name, "numphotos") == 0) {
 			/* gphoto:numphotos */
-			xmlChar *num_photos = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *num_photos = gxml_dom_element_get_content (elem);
 			if (num_photos == NULL || *num_photos == '\0') {
-				xmlFree (num_photos);
+				g_free (num_photos);
 				return gdata_parser_error_required_content_missing (node, error);
 			}
 
 			self->priv->num_photos = strtoul ((char*) num_photos, NULL, 10);
-			xmlFree (num_photos);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "numphotosremaining") == 0) {
+			g_free (num_photos);
+		} else if (g_strcmp0 (node_name, "numphotosremaining") == 0) {
 			/* gphoto:numphotosremaining */
-			xmlChar *num_photos_remaining = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *num_photos_remaining = gxml_dom_element_get_content (elem);
 			if (num_photos_remaining == NULL || *num_photos_remaining == '\0') {
-				xmlFree (num_photos_remaining);
+				g_free (num_photos_remaining);
 				return gdata_parser_error_required_content_missing (node, error);
 			}
 
 			self->priv->num_photos_remaining = strtoul ((char*) num_photos_remaining, NULL, 10);
-			xmlFree (num_photos_remaining);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "bytesUsed") == 0) {
+			g_free (num_photos_remaining);
+		} else if (g_strcmp0 (node_name, "bytesUsed") == 0) {
 			/* gphoto:bytesUsed */
-			xmlChar *bytes_used = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *bytes_used = gxml_dom_element_get_content (elem);
 			if (bytes_used == NULL || *bytes_used == '\0') {
-				xmlFree (bytes_used);
+				g_free (bytes_used);
 				return gdata_parser_error_required_content_missing (node, error);
 			}
 
 			self->priv->bytes_used = strtol ((char*) bytes_used, NULL, 10);
-			xmlFree (bytes_used);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "commentingEnabled") == 0) {
+			g_free (bytes_used);
+		} else if (g_strcmp0 (node_name, "commentingEnabled") == 0) {
 			/* gphoto:commentingEnabled */
-			xmlChar *commenting_enabled = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *commenting_enabled = gxml_dom_element_get_content (elem);
 			if (commenting_enabled == NULL || *commenting_enabled == '\0') {
-				xmlFree (commenting_enabled);
+				g_free (commenting_enabled);
 				return gdata_parser_error_required_content_missing (node, error);
 			}
 
 			gdata_picasaweb_album_set_is_commenting_enabled (self,
-			                                                 (xmlStrcmp (commenting_enabled, (xmlChar*) "true") == 0) ? TRUE : FALSE);
-			xmlFree (commenting_enabled);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "commentCount") == 0) {
+			                                                 (g_strcmp0 (commenting_enabled, "true") == 0) ? TRUE : FALSE);
+			g_free (commenting_enabled);
+		} else if (g_strcmp0 (node_name, "commentCount") == 0) {
 			/* gphoto:commentCount */
-			xmlChar *comment_count = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *comment_count = gxml_dom_element_get_content (elem);
 			if (comment_count == NULL || *comment_count == '\0') {
-				xmlFree (comment_count);
+				g_free (comment_count);
 				return gdata_parser_error_required_content_missing (node, error);
 			}
 
 			self->priv->comment_count = strtoul ((char*) comment_count, NULL, 10);
-			xmlFree (comment_count);
+			g_free (comment_count);
 		} else {
 			return GDATA_PARSABLE_CLASS (gdata_picasaweb_album_parent_class)->parse_xml (parsable, doc, node, user_data, error);
 		}
diff --git a/gdata/services/picasaweb/gdata-picasaweb-feed.c b/gdata/services/picasaweb/gdata-picasaweb-feed.c
index 749afd2..53a5c9d 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-feed.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-feed.c
@@ -31,13 +31,13 @@
  **/
 
 #include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
 
 #include "gdata-picasaweb-feed.h"
 #include "gdata-feed.h"
 #include "gdata-private.h"
 
-static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error);
+static gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error);
 
 G_DEFINE_TYPE (GDataPicasaWebFeed, gdata_picasaweb_feed, GDATA_TYPE_FEED)
 
@@ -55,31 +55,33 @@ gdata_picasaweb_feed_init (GDataPicasaWebFeed *self)
 }
 
 static gboolean
-parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
+parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error)
 {
+	const gchar *node_name = gxml_dom_xnode_get_node_name (node);
+
 	if (gdata_parser_is_namespace (node, "http://schemas.google.com/photos/2007";) == TRUE) {
-		if (xmlStrcmp (node->name, (xmlChar*) "user") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "nickname") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "quotacurrent") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "quotalimit") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "maxPhotosPerAlbum") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "thumbnail") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "allowDownloads") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "allowPrints") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "id") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "rights") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "location") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "access") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "timestamp") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "numphotos") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "numphotosremaining") == 0 ||
-		    xmlStrcmp (node->name, (xmlChar*) "bytesUsed") == 0) {
+		if (g_strcmp0 (node_name, "user") == 0 ||
+		    g_strcmp0 (node_name, "nickname") == 0 ||
+		    g_strcmp0 (node_name, "quotacurrent") == 0 ||
+		    g_strcmp0 (node_name, "quotalimit") == 0 ||
+		    g_strcmp0 (node_name, "maxPhotosPerAlbum") == 0 ||
+		    g_strcmp0 (node_name, "thumbnail") == 0 ||
+		    g_strcmp0 (node_name, "allowDownloads") == 0 ||
+		    g_strcmp0 (node_name, "allowPrints") == 0 ||
+		    g_strcmp0 (node_name, "id") == 0 ||
+		    g_strcmp0 (node_name, "rights") == 0 ||
+		    g_strcmp0 (node_name, "location") == 0 ||
+		    g_strcmp0 (node_name, "access") == 0 ||
+		    g_strcmp0 (node_name, "timestamp") == 0 ||
+		    g_strcmp0 (node_name, "numphotos") == 0 ||
+		    g_strcmp0 (node_name, "numphotosremaining") == 0 ||
+		    g_strcmp0 (node_name, "bytesUsed") == 0) {
 			/* From user's feed of album entries. Redundant with user entry represented by #GDataPicasaWebUser.
 			 * Capturing and ignoring. See bgo #589858. */
 		} else {
 			return GDATA_PARSABLE_CLASS (gdata_picasaweb_feed_parent_class)->parse_xml (parsable, doc, node, user_data, error);
 		}
-	} else if (gdata_parser_is_namespace (node, "http://www.georss.org/georss";) == TRUE && xmlStrcmp (node->name, (xmlChar*) "where") == 0) {
+	} else if (gdata_parser_is_namespace (node, "http://www.georss.org/georss";) == TRUE && g_strcmp0 (node_name, "where") == 0) {
 		/* From user's feed of album entries. Redundant with user entry represented by #GDataPicasaWebUser.
 		 * Capturing and ignoring. See bgo #589858. */
 	} else {
diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.c b/gdata/services/picasaweb/gdata-picasaweb-file.c
index 6d69ccc..7346b89 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-file.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-file.c
@@ -117,7 +117,7 @@ static void gdata_picasaweb_file_finalize (GObject *object);
 static void gdata_picasaweb_file_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_picasaweb_file_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 static void get_xml (GDataParsable *parsable, GString *xml_string);
-static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error);
+static gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error);
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
 static gchar *get_entry_uri (const gchar *id) G_GNUC_WARN_UNUSED_RESULT;
 GDataAuthorizationDomain *get_authorization_domain (GDataCommentable *self) G_GNUC_CONST;
@@ -888,10 +888,12 @@ gdata_picasaweb_file_set_property (GObject *object, guint property_id, const GVa
 }
 
 static gboolean
-parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
+parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error)
 {
 	gboolean success;
 	GDataPicasaWebFile *self = GDATA_PICASAWEB_FILE (parsable);
+	const gchar *node_name = gxml_dom_xnode_get_node_name (node);
+	GXmlDomElement *elem = GXML_DOM_ELEMENT (node);
 
 	/* TODO: media:group should also be P_NO_DUPES, but we can't, as priv->media_group has to be pre-populated
 	 * in order for things like gdata_picasaweb_file_set_description() to work. */
@@ -918,53 +920,53 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
 		    gdata_parser_string_from_element (node, "id", P_REQUIRED | P_NON_EMPTY | P_NO_DUPES,
 		                                      &(self->priv->file_id), &success, error) == TRUE) {
 			return success;
-		} else if (xmlStrcmp (node->name, (xmlChar*) "width") == 0) {
+		} else if (g_strcmp0 (node_name, "width") == 0) {
 			/* gphoto:width */
-			xmlChar *width = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *width = gxml_dom_element_get_content (elem);
 			self->priv->width = strtoul ((gchar*) width, NULL, 10);
-			xmlFree (width);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "height") == 0) {
+			g_free (width);
+		} else if (g_strcmp0 (node_name, "height") == 0) {
 			/* gphoto:height */
-			xmlChar *height = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *height = gxml_dom_element_get_content (elem);
 			self->priv->height = strtoul ((gchar*) height, NULL, 10);
-			xmlFree (height);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "size") == 0) {
+			g_free (height);
+		} else if (g_strcmp0 (node_name, "size") == 0) {
 			/* gphoto:size */
-			xmlChar *size = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *size = gxml_dom_element_get_content (elem);
 			self->priv->size = strtoul ((gchar*) size, NULL, 10);
-			xmlFree (size);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "timestamp") == 0) {
+			g_free (size);
+		} else if (g_strcmp0 (node_name, "timestamp") == 0) {
 			/* gphoto:timestamp */
-			xmlChar *timestamp_str;
+			gchar *timestamp_str;
 			guint64 milliseconds;
 
-			timestamp_str = xmlNodeListGetString (doc, node->children, TRUE);
+			timestamp_str = gxml_dom_element_get_content (elem);
 			milliseconds = g_ascii_strtoull ((gchar*) timestamp_str, NULL, 10);
-			xmlFree (timestamp_str);
+			g_free (timestamp_str);
 
 			gdata_picasaweb_file_set_timestamp (self, (gint64) milliseconds);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "commentingEnabled") == 0) {
+		} else if (g_strcmp0 (node_name, "commentingEnabled") == 0) {
 			/* gphoto:commentingEnabled */
-			xmlChar *is_commenting_enabled = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *is_commenting_enabled = gxml_dom_element_get_content (elem);
 			if (is_commenting_enabled == NULL)
 				return gdata_parser_error_required_content_missing (node, error);
-			self->priv->is_commenting_enabled = (xmlStrcmp (is_commenting_enabled, (xmlChar*) "true") == 0 ? TRUE : FALSE);
-			xmlFree (is_commenting_enabled);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "commentCount") == 0) {
+			self->priv->is_commenting_enabled = (g_strcmp0 (is_commenting_enabled, "true") == 0 ? TRUE : FALSE);
+			g_free (is_commenting_enabled);
+		} else if (g_strcmp0 (node_name, "commentCount") == 0) {
 			/* gphoto:commentCount */
-			xmlChar *comment_count = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *comment_count = gxml_dom_element_get_content (elem);
 			self->priv->comment_count = strtoul ((gchar*) comment_count, NULL, 10);
-			xmlFree (comment_count);
-		} else if (xmlStrcmp (node->name, (xmlChar*) "access") == 0) {
+			g_free (comment_count);
+		} else if (g_strcmp0 (node_name, "access") == 0) {
 			/* gphoto:access */
 			/* Visibility is already obtained through the album. When PicasaWeb supports per-file access restrictions,
 			 * we'll expose this property. Until then, we'll catch this to suppress the Unhandled XML warning.
 			 * See https://bugzilla.gnome.org/show_bug.cgi?id=589858 */
-		} else if (xmlStrcmp (node->name, (xmlChar*) "rotation") == 0) {
+		} else if (g_strcmp0 (node_name, "rotation") == 0) {
 			/* gphoto:rotation */
-			xmlChar *rotation = xmlNodeListGetString (doc, node->children, TRUE);
+			gchar *rotation = gxml_dom_element_get_content (elem);
 			gdata_picasaweb_file_set_rotation (self, strtoul ((gchar*) rotation, NULL, 10));
-			xmlFree (rotation);
+			g_free (rotation);
 		} else {
 			return GDATA_PARSABLE_CLASS (gdata_picasaweb_file_parent_class)->parse_xml (parsable, doc, node, user_data, error);
 		}
diff --git a/gdata/services/picasaweb/gdata-picasaweb-user.c b/gdata/services/picasaweb/gdata-picasaweb-user.c
index e02e8c4..b06e3be 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-user.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-user.c
@@ -31,7 +31,7 @@
  **/
 
 #include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
 
 #include "gdata-picasaweb-user.h"
 #include "gdata-entry.h"
@@ -39,7 +39,7 @@
 
 static void gdata_picasaweb_user_finalize (GObject *object);
 static void gdata_picasaweb_user_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
-static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error);
+static gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error);
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
 
 struct _GDataPicasaWebUserPrivate {
@@ -224,10 +224,12 @@ gdata_picasaweb_user_get_property (GObject *object, guint property_id, GValue *v
 }
 
 static gboolean
-parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
+parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error)
 {
 	gboolean success;
 	GDataPicasaWebUser *self = GDATA_PICASAWEB_USER (parsable);
+	const gchar *node_name = gxml_dom_xnode_get_node_name (node);
+	GXmlDomElement *elem = GXML_DOM_ELEMENT (node);
 
 	if (gdata_parser_is_namespace (node, "http://schemas.google.com/photos/2007";) == FALSE)
 		return GDATA_PARSABLE_CLASS (gdata_picasaweb_user_parent_class)->parse_xml (parsable, doc, node, user_data, error);
@@ -236,25 +238,25 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
 	    gdata_parser_string_from_element (node, "nickname", P_REQUIRED | P_NON_EMPTY, &(self->priv->nickname), &success, error) == TRUE ||
 	    gdata_parser_string_from_element (node, "thumbnail", P_REQUIRED | P_NON_EMPTY, &(self->priv->thumbnail_uri), &success, error) == TRUE) {
 		return success;
-	} else if (xmlStrcmp (node->name, (xmlChar*) "quotacurrent") == 0) {
+	} else if (g_strcmp0 (node_name, "quotacurrent") == 0) {
 		/* gphoto:quota-current */
-		xmlChar *quota_current = xmlNodeListGetString (doc, node->children, TRUE);
+		gchar *quota_current = gxml_dom_element_get_content (elem);
 		self->priv->quota_current = g_ascii_strtoll ((const gchar*) quota_current, NULL, 10);
-		xmlFree (quota_current);
-	} else if (xmlStrcmp (node->name, (xmlChar*) "quotalimit") == 0) {
+		g_free (quota_current);
+	} else if (g_strcmp0 (node_name, "quotalimit") == 0) {
 		/* gphoto:quota-limit */
-		xmlChar *quota_limit = xmlNodeListGetString (doc, node->children, TRUE);
+		gchar *quota_limit = gxml_dom_element_get_content (elem);
 		self->priv->quota_limit = g_ascii_strtoll ((const gchar*) quota_limit, NULL, 10);
-		xmlFree (quota_limit);
-	} else if (xmlStrcmp (node->name, (xmlChar*) "maxPhotosPerAlbum") == 0) {
+		g_free (quota_limit);
+	} else if (g_strcmp0 (node_name, "maxPhotosPerAlbum") == 0) {
 		/* gphoto:max-photos-per-album */
-		xmlChar *max_photos_per_album = xmlNodeListGetString (doc, node->children, TRUE);
+		gchar *max_photos_per_album = gxml_dom_element_get_content (elem);
 		self->priv->max_photos_per_album = strtol ((char*) max_photos_per_album, NULL, 10);
-		xmlFree (max_photos_per_album);
-	} else if (xmlStrcmp (node->name, (xmlChar*) "x-allowDownloads") == 0) { /* RHSTODO: see if this comes with the user */
+		g_free (max_photos_per_album);
+	} else if (g_strcmp0 (node_name, "x-allowDownloads") == 0) { /* RHSTODO: see if this comes with the user */
 		/* gphoto:allowDownloads */
 		/* TODO: Not part of public API so we're capturing and ignoring for now.  See bgo #589858. */
-	} else if (xmlStrcmp (node->name, (xmlChar*) "x-allowPrints") == 0) { /* RHSTODO: see if this comes with the user */
+	} else if (g_strcmp0 (node_name, "x-allowPrints") == 0) { /* RHSTODO: see if this comes with the user */
 		/* gphoto:allowPrints */
 		/* TODO: Not part of public API so we're capturing and ignoring for now.  See bgo #589858. */
 	} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]