/* Common XML format for both Bijiben / Tomboy */ static void processNode (BijiLazyDeserializer *self) { xmlTextReaderPtr r = self->priv->r; BijiNoteObj * n = self->priv->note; xmlChar *name; GdkRGBA *color; gchar *tag; GString *norm; gchar *debug; name = xmlTextReaderName (r); if ( g_strcmp0((gchar*)name,"title") == 0 ) biji_process_string (r, (BijiReaderFunc*) biji_note_obj_set_title, n); if ( g_strcmp0((gchar*)name,"text") == 0 ) { if (self->priv->type == BIJIBEN_1) { self->priv->content = (gchar*) xmlTextReaderReadInnerXml (r); process_bijiben_html_content (self); } else if (self->priv->type == TOMBOY_1 || self->priv->type == TOMBOY_2 || self->priv->type == TOMBOY_3 ) { self->priv->content = (gchar*) xmlTextReaderReadInnerXml (r); process_tomboy_xml_content (self); } } if (g_strcmp0 ((gchar*) name, "last-change-date") == 0) biji_process_string (r, (BijiReaderFunc*) biji_note_obj_set_last_change_date, n); if (g_strcmp0 ((gchar*) name, "last-metadata-change-date") == 0) biji_process_string (r, (BijiReaderFunc*) biji_note_obj_set_last_metadata_change_date, n); if (g_strcmp0 ((gchar*) name, "create-date") == 0) biji_process_string (r, (BijiReaderFunc*) biji_note_obj_set_create_date, n); if (g_strcmp0 ((gchar*) name, "color") == 0 ) { color = g_new (GdkRGBA,1); debug = (gchar*) xmlTextReaderReadString (r); if ( gdk_rgba_parse (color,debug)) { biji_note_obj_set_rgba (n, color); } else { g_warning ("color invalid:%s",debug); } free (debug); } if ( g_strcmp0((gchar*)name,"tag") == 0 ) { tag = (gchar*) xmlTextReaderReadString(r); if (g_str_has_prefix (tag,"system:template")) { note_obj_set_is_template(n,TRUE); } else if (g_str_has_prefix (tag,"system:notebook:")) { norm = g_string_new (tag); g_string_erase (norm,0,16); _biji_note_obj_set_tags (n, g_list_prepend((GList*)_biji_note_obj_get_tags(n), g_string_free (norm,FALSE))); } free (tag); } xmlFree(name); }
/* Common XML format for both Bijiben / Tomboy */ static void processNode (BijiLazyDeserializer *self) { xmlTextReaderPtr r = self->priv->r; BijiNoteObj * n = self->priv->note; xmlChar *name; GdkRGBA color; gchar *tag, *color_str; GString *norm; name = xmlTextReaderName (r); if ( g_strcmp0((gchar*)name,"title") == 0 ) biji_process_string (r, (BijiReaderFunc*) biji_note_obj_set_title, n); if ( g_strcmp0((gchar*)name,"text") == 0 ) { if (self->priv->type == BIJIBEN_1) { process_bijiben_html_content (self, r); } else if (self->priv->type == TOMBOY_1 || self->priv->type == TOMBOY_2 || self->priv->type == TOMBOY_3 ) { self->priv->content = (gchar*) xmlTextReaderReadInnerXml (r); process_tomboy_xml_content (self); } } if (g_strcmp0 ((gchar*) name, "last-change-date") == 0) { gchar *result = (gchar*) xmlTextReaderReadString (r); biji_note_obj_set_mtime (n, iso8601_to_gint64 (result)); free (result); } if (g_strcmp0 ((gchar*) name, "last-metadata-change-date") == 0) { gchar *result = (gchar*) xmlTextReaderReadString (r); biji_note_obj_set_last_metadata_change_date (n, iso8601_to_gint64 (result)); free (result); } if (g_strcmp0 ((gchar*) name, "create-date") == 0) { gchar *result = (gchar*) xmlTextReaderReadString (r); biji_note_obj_set_create_date (n, iso8601_to_gint64 (result)); free (result); } if (g_strcmp0 ((gchar*) name, "color") == 0 ) { color_str = (gchar*) xmlTextReaderReadString (r); if (gdk_rgba_parse (&color, color_str)) biji_note_obj_set_rgba (n, &color); else g_warning ("color invalid:%s", color_str); free (color_str); } if ( g_strcmp0((gchar*)name,"tag") == 0 ) { tag = (gchar*) xmlTextReaderReadString(r); if (g_str_has_prefix (tag,"system:template")) { note_obj_set_is_template(n,TRUE); } else if (g_str_has_prefix (tag,"system:notebook:")) { norm = g_string_new (tag); g_string_erase (norm,0,16); biji_item_add_notebook (BIJI_ITEM (n), NULL, norm->str); g_string_free (norm, TRUE); } free (tag); } xmlFree(name); }