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

Re: [xml] serializing dtd nodes (python)



On Fri, Apr 25, 2003 at 05:35:20PM +0200, Petr Pajas wrote:
> Hi,
> 
> I'm using libxml2 (2.5.7) to parse a DTD. When I try to serialize it
> back I get None unless I create a new document (completely unrelated
> to the dtd node) before doing so. That's weird.  

  Hum, it's a bug, side effect of access to freed memory :-(
The enclosed patch should fix it, it does for me ...

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: parser.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/parser.c,v
retrieving revision 1.263
diff -c -r1.263 parser.c
*** parser.c	24 Apr 2003 16:06:45 -0000	1.263
--- parser.c	25 Apr 2003 16:40:16 -0000
***************
*** 9613,9618 ****
--- 9613,9628 ----
  	if (ctxt->wellFormed) {
  	    ret = ctxt->myDoc->extSubset;
  	    ctxt->myDoc->extSubset = NULL;
+ 	    if (ret != NULL) {
+ 		xmlNodePtr tmp;
+ 
+ 		ret->doc = NULL;
+ 		tmp = ret->children;
+ 		while (tmp != NULL) {
+ 		    tmp->doc = NULL;
+ 		    tmp = tmp->next;
+ 		}
+ 	    }
  	} else {
  	    ret = NULL;
  	}


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