Re: xml->root, libxml2



Hi Lutz,

On Wed, 18 Oct 2000, [ISO-8859-1] Lutz Mller wrote:
> >         Bonobo is emphaticly not compatible with libxml2, it should
not
> > even compile for you, I don't quite know how you managed to get it to  
> > build :-)
> 
> libxml2 isn't that different. Substitution of direct access ("->root")
> by the corresponding function xmlDocGet/SetRootElement is a big step  
> towards bonobo being able to work with both libxml1 and libxml2.

        I think you are not aware of quite how tightly coupled the xml UI
model is to libxml1; it is _very_ tightly coupled.

> I volunteer to do the substitution. Attached are two diffs against the
> latest CVS source that substitute direct access (->root) by the
> already mentioned two little functions. Nothing else changed.   

        Ok; so I worked your diffs into the attached patch ( diff -u and a
ChangeLog saves me time ), and I tested it and it crashed :-) it is not   
this simple, the compat accessors are seemingly not functionaly identical 
( and glancing at them this seems so ), or I screwed something in the
patch.

> If you like the diffs, commit to CVS and I'll gladly continue to work
> on getting bonobo to work with both libxml1 and libxml2.

        I would of course, very much like a libxml2 compatibility patch,
and I'd like to commit this fix, but please convert the code and test it  
against libxml1 as well.

        Thanks,
  
                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot
? nat
? lutz.diff
? old-nat.tar.gz
? a.diff
? MChangeLog
? ui-handler-sketch.idl
? mathieu.diff
? bonobo-0.23.tar.gz
? danw.diff
? dan.diff
? bonobo/a.c
? bonobo/a.h
? bonobo/tmp
? bonobo/test-storage.c
? bonobo/bonobo-plug.c.instr
? bonobo/a.pic
? bonobo/a.out
? bonobo/a.png
? bonobo/purify.log
? bonobo/test-container-autoload.c
? bonobo/andy.diff
? bonobo/selector_test.c
? bonobo/a.diff
? bonobo/bonobo-object-directory-goad.c
? bonobo/log1.txt
? bonobo/log2.txt
? bonobo/test-container.c
? bonobo/bonobo-socket.c.instr
? components/application-x-gnomine/bonobo-application-x-mines-ui.xml.h
? components/audio-ulaw/doc/C/DBTOHTML_OUTPUT_DIR30566
? idl/bonobo-storage-fat.idl
? samples/compound-doc/container/container
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.655
diff -u -r1.655 ChangeLog
--- ChangeLog	2000/10/18 23:00:49	1.655
+++ ChangeLog	2000/10/18 23:12:15
@@ -1,3 +1,11 @@
+2000-10-19  Lutz Müller  <urc8 rz uni-karlsruhe de>
+
+	* bonobo/bonobo-ui-node.c (bonobo_ui_node_to_string),
+	(bonobo_ui_node_from_string, bonobo_ui_node_from_file): use libxml2
+	compatibility macros.
+
+	* bonobo/bonobo-ui-xml.c (bonobo_ui_xml_dump): ditto.
+
 2000-10-18  Michael Meeks  <michael helixcode com>
 
 	* doc/ui-faq.txt (practice): remove show all comment; has been fixed.
Index: bonobo/bonobo-ui-node.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-node.c,v
retrieving revision 1.7
diff -u -r1.7 bonobo-ui-node.c
--- bonobo/bonobo-ui-node.c	2000/10/17 16:58:46	1.7
+++ bonobo/bonobo-ui-node.c	2000/10/18 23:12:16
@@ -206,18 +206,20 @@
 {
 	xmlDoc     *doc;
 	xmlChar    *mem = NULL;
+	xmlNode    *copy;
 	int         size;
 
 	doc = xmlNewDoc ("1.0");
 	g_return_val_if_fail (doc != NULL, NULL);
 
-	doc->root = XML_NODE(bonobo_ui_node_copy (node, TRUE));
-	g_return_val_if_fail (doc->root != NULL, NULL);
+	copy = XML_NODE(bonobo_ui_node_copy (node, TRUE));
+	g_return_val_if_fail (copy != NULL, NULL);
+	xmlDocSetRootElement (doc, copy);
 
-	if (!recurse && bonobo_ui_node_children (BNODE(doc->root))) {
+	if (!recurse && bonobo_ui_node_children (BNODE(copy))) {
 		BonoboUINode *tmp;
-		while ((tmp = bonobo_ui_node_children (BNODE(doc->root)))) {
-			xmlUnlinkNode (XML_NODE(tmp));
+		while ((tmp = bonobo_ui_node_children (BNODE(copy)))) {
+			xmlUnlinkNode (XML_NODE (tmp));
 			bonobo_ui_node_free (tmp);
 		}
 	}
@@ -242,9 +244,9 @@
 	if (!doc)
 		return NULL;
 	
-	node = BNODE (doc->root);
+	node = BNODE (xmlDocGetRootElement (doc));
 
-	doc->root = NULL;
+	xmlDocSetRootElement (doc, NULL);
 	
 	xmlFreeDoc (doc);
 
@@ -266,9 +268,9 @@
 
 	g_return_val_if_fail (doc != NULL, NULL);
 
-	node = BNODE (doc->root);
+	node = BNODE (xmlDocGetRootElement (doc));
 
-	doc->root = NULL;
+	xmlDocSetRootElement (doc, NULL);
 	xmlFreeDoc (doc);
 
 	return node;
Index: bonobo/bonobo-ui-xml.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-xml.c,v
retrieving revision 1.38
diff -u -r1.38 bonobo-ui-xml.c
--- bonobo/bonobo-ui-xml.c	2000/10/14 17:54:03	1.38
+++ bonobo/bonobo-ui-xml.c	2000/10/18 23:12:18
@@ -372,13 +372,13 @@
         xmlNode *node = XML_NODE (bnode);
 
 	doc = xmlNewDoc ("1.0");
-	doc->root = node;
+	xmlDocSetRootElement (doc, XML_NODE (node));
 	
 	fprintf (stderr, "%s\n", descr);
 
 	xmlDocDump (stderr, doc);
 
-	doc->root = NULL;
+	xmlDocSetRootElement (doc, NULL);
 	xmlFreeDoc (doc);
 	fprintf (stderr, "--- Internals ---\n");
 	dump_internals (tree, BNODE (node));


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