[gnome-db] gda_data_model_to_xml



Hi,

It seems that gda_data_model_to_xml() does not currently work when
standalone = FALSE (always returns NULL).

According to the ChangeLog, it is not yet implemented.

So here is a patch to provide missing code.

Cheers,

-- 
{ "Laurent" => "http://lrz.samika.net"; }
Index: gda-data-model.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-data-model.c,v
retrieving revision 1.38
diff -u -r1.38 gda-data-model.c
--- gda-data-model.c	18 Oct 2003 23:03:52 -0000	1.38
+++ gda-data-model.c	25 Oct 2003 11:47:35 -0000
@@ -829,17 +829,21 @@
 gchar *
 gda_data_model_to_xml (GdaDataModel *model, gboolean standalone)
 {
-	xmlDocPtr xml_doc;
-	xmlNodePtr xml_root, xml_node, xml_tables;
-	gchar *xml = NULL;
 	xmlChar *xml_contents;
+	xmlNodePtr xml_node;
+	gchar *xml;
 	gint size;
 
 	g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
 
 	xml_node = gda_data_model_to_xml_node (model, "exported_model");
+
 	if (standalone) {
+		xmlDocPtr xml_doc;
+		xmlNodePtr xml_root, xml_tables;
+	
 		xml_doc = xmlNewDoc ("1.0");
+		
 		xml_root = xmlNewDocNode (xml_doc, NULL, "database", NULL);
 		xmlDocSetRootElement (xml_doc, xml_root);
 
@@ -848,7 +852,15 @@
 
 		xmlDocDumpMemory (xml_doc, &xml_contents, &size);
 		xmlFreeDoc (xml_doc);
-
+		
+		xml = g_strdup (xml_contents);
+		xmlFree (xml_contents);
+	}
+	else {
+		xmlBufferPtr xml_buf = xmlBufferCreate ();
+		xmlNodeDump (xml_buf, NULL, xml_node, 0, 0); 
+		xml_contents = (xmlChar *) xmlBufferContent (xml_buf);
+		xmlBufferFree (xml_buf);
 		xml = g_strdup (xml_contents);
 	}
 


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