[libgdata/gxml] * prot gdata-gd-{reminder,when,where,who}
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata/gxml] * prot gdata-gd-{reminder,when,where,who}
- Date: Sat, 24 Sep 2011 06:22:14 +0000 (UTC)
commit d3bbdf3b7cff724043d745639a08d1501aa602d4
Author: Richard Schwarting <aquarichy gmail com>
Date: Fri Jul 22 18:03:31 2011 -0400
* prot gdata-gd-{reminder,when,where,who}
gdata/gd/gdata-gd-reminder.c | 35 ++++++++++++++++++-----------------
gdata/gd/gdata-gd-when.c | 39 ++++++++++++++++++++-------------------
gdata/gd/gdata-gd-where.c | 23 ++++++++++++-----------
gdata/gd/gdata-gd-who.c | 29 +++++++++++++++--------------
4 files changed, 65 insertions(+), 61 deletions(-)
---
diff --git a/gdata/gd/gdata-gd-reminder.c b/gdata/gd/gdata-gd-reminder.c
index 8ed7344..eca23bd 100644
--- a/gdata/gd/gdata-gd-reminder.c
+++ b/gdata/gd/gdata-gd-reminder.c
@@ -30,7 +30,7 @@
**/
#include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
#include "gdata-gd-reminder.h"
#include "gdata-parsable.h"
@@ -42,7 +42,7 @@ static void gdata_gd_reminder_comparable_init (GDataComparableIface *iface);
static void gdata_gd_reminder_finalize (GObject *object);
static void gdata_gd_reminder_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void gdata_gd_reminder_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);
@@ -238,42 +238,43 @@ gdata_gd_reminder_set_property (GObject *object, guint property_id, const GValue
}
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)
{
GDataGDReminderPrivate *priv = GDATA_GD_REMINDER (parsable)->priv;
- xmlChar *absolute_time, *relative_time;
+ gchar *absolute_time, *relative_time;
gint64 absolute_time_int64;
gint relative_time_int = -1;
gboolean is_absolute_time = FALSE;
+ GXmlDomElement *root_elem = GXML_DOM_ELEMENT (root_node);
/* Absolute time */
- absolute_time = xmlGetProp (root_node, (xmlChar*) "absoluteTime");
+ absolute_time = gxml_dom_element_get_attribute (root_elem, "absoluteTime");
if (absolute_time != NULL) {
is_absolute_time = TRUE;
- if (gdata_parser_int64_from_iso8601 ((gchar*) absolute_time, &absolute_time_int64) == FALSE) {
+ if (gdata_parser_int64_from_iso8601 (absolute_time, &absolute_time_int64) == FALSE) {
/* Error */
- gdata_parser_error_not_iso8601_format (root_node, (gchar*) absolute_time, error);
- xmlFree (absolute_time);
+ gdata_parser_error_not_iso8601_format (root_node, absolute_time, error);
+ g_free (absolute_time);
return FALSE;
}
- xmlFree (absolute_time);
+ g_free (absolute_time);
}
/* Relative time */
- relative_time = xmlGetProp (root_node, (xmlChar*) "days");
+ relative_time = gxml_dom_element_get_attribute (root_elem, "days");
if (relative_time != NULL) {
- relative_time_int = strtol ((gchar*) relative_time, NULL, 10) * 60 * 24;
+ relative_time_int = strtol (relative_time, NULL, 10) * 60 * 24;
} else {
- relative_time = xmlGetProp (root_node, (xmlChar*) "hours");
+ relative_time = gxml_dom_element_get_attribute (root_elem, "hours");
if (relative_time != NULL) {
- relative_time_int = strtol ((gchar*) relative_time, NULL, 10) * 60;
+ relative_time_int = strtol (relative_time, NULL, 10) * 60;
} else {
- relative_time = xmlGetProp (root_node, (xmlChar*) "minutes");
+ relative_time = gxml_dom_element_get_attribute (root_elem, "minutes");
if (relative_time != NULL)
- relative_time_int = strtol ((gchar*) relative_time, NULL, 10);
+ relative_time_int = strtol (relative_time, NULL, 10);
}
}
- xmlFree (relative_time);
+ g_free (relative_time);
if (is_absolute_time == TRUE) {
priv->absolute_time = absolute_time_int64;
@@ -283,7 +284,7 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
priv->relative_time = relative_time_int;
}
- priv->method = (gchar*) xmlGetProp (root_node, (xmlChar*) "method");
+ priv->method = gxml_dom_element_get_attribute (root_elem, "method");
return TRUE;
}
diff --git a/gdata/gd/gdata-gd-when.c b/gdata/gd/gdata-gd-when.c
index 656d878..67088ab 100644
--- a/gdata/gd/gdata-gd-when.c
+++ b/gdata/gd/gdata-gd-when.c
@@ -30,7 +30,7 @@
**/
#include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
#include "gdata-gd-when.h"
#include "gdata-gd-reminder.h"
@@ -45,8 +45,8 @@ static void gdata_gd_when_dispose (GObject *object);
static void gdata_gd_when_finalize (GObject *object);
static void gdata_gd_when_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void gdata_gd_when_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 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 gboolean parse_xml (GDataParsable *parsable, GXmlDomDocument *doc, GXmlDomXNode *root_node, gpointer user_data, GError **error);
static gboolean post_parse_xml (GDataParsable *parsable, gpointer user_data, GError **error);
static void pre_get_xml (GDataParsable *parsable, GString *xml_string);
static void get_xml (GDataParsable *parsable, GString *xml_string);
@@ -265,42 +265,43 @@ gdata_gd_when_set_property (GObject *object, guint property_id, const GValue *va
}
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)
{
GDataGDWhenPrivate *priv = GDATA_GD_WHEN (parsable)->priv;
- xmlChar *start_time, *end_time;
+ gchar *start_time, *end_time;
gint64 start_time_int64, end_time_int64;
gboolean is_date = FALSE;
+ GXmlDomElement *root_elem = GXML_DOM_ELEMENT (root_node);
/* Start time */
- start_time = xmlGetProp (root_node, (xmlChar*) "startTime");
- if (gdata_parser_int64_from_date ((gchar*) start_time, &start_time_int64) == TRUE) {
+ start_time = gxml_dom_element_get_attribute (root_elem, "startTime");
+ if (gdata_parser_int64_from_date (start_time, &start_time_int64) == TRUE) {
is_date = TRUE;
- } else if (gdata_parser_int64_from_iso8601 ((gchar*) start_time, &start_time_int64) == FALSE) {
+ } else if (gdata_parser_int64_from_iso8601 (start_time, &start_time_int64) == FALSE) {
/* Error */
- gdata_parser_error_not_iso8601_format (root_node, (gchar*) start_time, error);
- xmlFree (start_time);
+ gdata_parser_error_not_iso8601_format (root_node, start_time, error);
+ g_free (start_time);
return FALSE;
}
- xmlFree (start_time);
+ g_free (start_time);
/* End time (optional) */
- end_time = xmlGetProp (root_node, (xmlChar*) "endTime");
+ end_time = gxml_dom_element_get_attribute (root_elem, "endTime");
if (end_time != NULL) {
gboolean success;
if (is_date == TRUE)
- success = gdata_parser_int64_from_date ((gchar*) end_time, &end_time_int64);
+ success = gdata_parser_int64_from_date (end_time, &end_time_int64);
else
- success = gdata_parser_int64_from_iso8601 ((gchar*) end_time, &end_time_int64);
+ success = gdata_parser_int64_from_iso8601 (end_time, &end_time_int64);
if (success == FALSE) {
/* Error */
- gdata_parser_error_not_iso8601_format (root_node, (gchar*) end_time, error);
- xmlFree (end_time);
+ gdata_parser_error_not_iso8601_format (root_node, end_time, error);
+ g_free (end_time);
return FALSE;
}
- xmlFree (end_time);
+ g_free (end_time);
} else {
/* Give a default */
end_time_int64 = -1;
@@ -309,13 +310,13 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
priv->start_time = start_time_int64;
priv->end_time = end_time_int64;
priv->is_date = is_date;
- priv->value_string = (gchar*) xmlGetProp (root_node, (xmlChar*) "valueString");
+ priv->value_string = gxml_dom_element_get_attribute (root_elem, "valueString");
return TRUE;
}
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;
diff --git a/gdata/gd/gdata-gd-where.c b/gdata/gd/gdata-gd-where.c
index 63075d1..1234aa6 100644
--- a/gdata/gd/gdata-gd-where.c
+++ b/gdata/gd/gdata-gd-where.c
@@ -30,7 +30,7 @@
**/
#include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
#include "gdata-gd-where.h"
#include "gdata-parsable.h"
@@ -41,8 +41,8 @@ static void gdata_gd_where_comparable_init (GDataComparableIface *iface);
static void gdata_gd_where_finalize (GObject *object);
static void gdata_gd_where_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void gdata_gd_where_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 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 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);
@@ -212,26 +212,27 @@ gdata_gd_where_set_property (GObject *object, guint property_id, const GValue *v
}
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 *rel;
+ gchar *rel;
GDataGDWherePrivate *priv = GDATA_GD_WHERE (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->relation_type = (gchar*) rel;
- priv->value_string = (gchar*) xmlGetProp (root_node, (xmlChar*) "valueString");
- priv->label = (gchar*) xmlGetProp (root_node, (xmlChar*) "label");
+ priv->relation_type = rel;
+ priv->value_string = gxml_dom_element_get_attribute (root_elem, "valueString");
+ priv->label = gxml_dom_element_get_attribute (root_elem, "label");
return TRUE;
}
/*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)
{
GDataGDWherePrivate *priv = GDATA_GD_WHERE (parsable)->priv;
diff --git a/gdata/gd/gdata-gd-who.c b/gdata/gd/gdata-gd-who.c
index 1264ed9..2717c36 100644
--- a/gdata/gd/gdata-gd-who.c
+++ b/gdata/gd/gdata-gd-who.c
@@ -30,7 +30,7 @@
**/
#include <glib.h>
-#include <libxml/parser.h>
+#include <gxml.h>
#include "gdata-gd-who.h"
#include "gdata-parsable.h"
@@ -41,8 +41,8 @@ static void gdata_gd_who_comparable_init (GDataComparableIface *iface);
static void gdata_gd_who_finalize (GObject *object);
static void gdata_gd_who_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static void gdata_gd_who_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 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 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);
@@ -212,33 +212,34 @@ gdata_gd_who_set_property (GObject *object, guint property_id, const GValue *val
}
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 *rel, *email;
+ gchar *rel, *email;
GDataGDWhoPrivate *priv = GDATA_GD_WHO (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);
}
- email = xmlGetProp (root_node, (xmlChar*) "email");
+ email = gxml_dom_element_get_attribute (root_elem, "email");
if (email != NULL && *email == '\0') {
- xmlFree (rel);
- xmlFree (email);
+ g_free (rel);
+ g_free (email);
return gdata_parser_error_required_property_missing (root_node, "email", error);
}
- priv->relation_type = (gchar*) rel;
- priv->value_string = (gchar*) xmlGetProp (root_node, (xmlChar*) "valueString");
- priv->email_address = (gchar*) email;
+ priv->relation_type = rel;
+ priv->value_string = gxml_dom_element_get_attribute (root_elem, "valueString");
+ priv->email_address = email;
return TRUE;
}
/*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)
{
GDataGDWhoPrivate *priv = GDATA_GD_WHO (parsable)->priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]