[libgdata/gxml] * automagically port gdata-gcontact-{jot,language}



commit 12086b261f7e2739322c08829a7d181ca6aa2251
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 23 13:06:30 2011 -0400

    * automagically port gdata-gcontact-{jot,language}

 gdata/gcontact/gdata-gcontact-jot.c      |   19 ++++++++++---------
 gdata/gcontact/gdata-gcontact-language.c |   21 +++++++++++----------
 2 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/gdata/gcontact/gdata-gcontact-jot.c b/gdata/gcontact/gdata-gcontact-jot.c
index 923444a..004b1d1 100644
--- a/gdata/gcontact/gdata-gcontact-jot.c
+++ b/gdata/gcontact/gdata-gcontact-jot.c
@@ -39,8 +39,8 @@
 static void gdata_gcontact_jot_finalize (GObject *object);
 static void gdata_gcontact_jot_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_gcontact_jot_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static gboolean pre_parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, xmlNode *root_node, gpointer user_data, GError **error);
-static gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, xmlNode *root_node, gpointer user_data, GError **error);
+static gboolean pre_parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *root_node, gpointer user_data, GError **error);
+static gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *root_node, gpointer user_data, GError **error);
 static void pre_get_xml (GDataParsable *parsable, GString *xml_string);
 static void get_xml (GDataParsable *parsable, GString *xml_string);
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
@@ -167,28 +167,29 @@ gdata_gcontact_jot_set_property (GObject *object, guint property_id, const GValu
 }
 
 static gboolean
-pre_parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, xmlNode *root_node, gpointer user_data, GError **error)
+pre_parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *root_node, gpointer user_data, GError **error)
 {
-	xmlChar *rel;
+	gchar *rel;
 	GDataGContactJotPrivate *priv = GDATA_GCONTACT_JOT (parsable)->priv;
+	GXmlDomElement *root_elem = GXML_DOM_ELEMENT (root_node);
 
-	rel = xmlGetProp (root_node, (xmlChar*) "rel");
+	rel = gxml_dom_element_get_attribute (root_elem, "rel");
 	if (rel == NULL || *rel == '\0') {
-		xmlFree (rel);
+		g_free (rel);
 		return gdata_parser_error_required_property_missing (root_node, "rel", error);
 	}
 
-	priv->content = (gchar*) xmlNodeListGetString (doc, root_node->children, TRUE);
+	priv->content = gxml_dom_element_content_to_string (root_elem);
 	priv->relation_type = (gchar*) rel;
 
 	return TRUE;
 }
 
 static gboolean
-parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, xmlNode *node, gpointer user_data, GError **error)
+parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *node, gpointer user_data, GError **error)
 {
 	/* Textual content's handled in pre_parse_xml */
-	if (node->type != XML_ELEMENT_NODE)
+	if (gxml_dom_xnode_get_node_type (node) != GXML_DOM_NODE_TYPE_ELEMENT)
 		return TRUE;
 
 	return GDATA_PARSABLE_CLASS (gdata_gcontact_jot_parent_class)->parse_xml (parsable, doc, node, user_data, error);
diff --git a/gdata/gcontact/gdata-gcontact-language.c b/gdata/gcontact/gdata-gcontact-language.c
index 44a4361..e791232 100644
--- a/gdata/gcontact/gdata-gcontact-language.c
+++ b/gdata/gcontact/gdata-gcontact-language.c
@@ -30,7 +30,7 @@
  **/
 
 #include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
 
 #include "gdata-gcontact-language.h"
 #include "gdata-parsable.h"
@@ -41,7 +41,7 @@ static void gdata_gcontact_language_comparable_init (GDataComparableIface *iface
 static void gdata_gcontact_language_finalize (GObject *object);
 static void gdata_gcontact_language_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void gdata_gcontact_language_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static gboolean pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error);
+static gboolean pre_parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *root_node, gpointer user_data, GError **error);
 static void pre_get_xml (GDataParsable *parsable, GString *xml_string);
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
 
@@ -182,21 +182,22 @@ gdata_gcontact_language_set_property (GObject *object, guint property_id, const
 }
 
 static gboolean
-pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointer user_data, GError **error)
+pre_parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *root_node, gpointer user_data, GError **error)
 {
-	xmlChar *code, *label;
+	gchar *code, *label;
 	GDataGContactLanguagePrivate *priv = GDATA_GCONTACT_LANGUAGE (parsable)->priv;
+	GXmlDomElement *root_elem = GXML_DOM_ELEMENT (root_node);
 
-	code = xmlGetProp (root_node, (xmlChar*) "code");
-	label = xmlGetProp (root_node, (xmlChar*) "label");
+	code = gxml_dom_element_get_attribute (root_elem, "code");
+	label = gxml_dom_element_get_attribute (root_elem, "label");
 	if ((code == NULL || *code == '\0') && (label == NULL || *label == '\0')) {
-		xmlFree (code);
-		xmlFree (label);
+		g_free (code);
+		g_free (label);
 		return gdata_parser_error_required_property_missing (root_node, "code", error);
 	} else if (code != NULL && label != NULL) {
 		/* Can't have both set at once */
-		xmlFree (code);
-		xmlFree (label);
+		g_free (code);
+		g_free (label);
 		return gdata_parser_error_mutexed_properties (root_node, "code", "label", error);
 	}
 



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