[xml] Setting a new DTD



Hi,

I wanted to replace a DTD reference in a parsed document with a new one.
Just adding a new internal subset doesn't work since libxml checks if we
already have a DTD and aborts.

So I wrote some code to remove the current DTD reference first:

xmlDtd* dtd = xmlGetIntSubset(_impl);
if(!dtd)
  return false;
    
_impl->intSubset=NULL;
xmlUnlinkNode((xmlNode*)dtd);
xmlFreeDtd(dtd);

This code works for me. But since this is the first time I hack on raw libxml 
(I've been using libxml++ for some time) I wanted to know if its correct. I'm 
not sure if it works in all cases, if I've got all the node linking right and 
that there are no memory leaks.

I would highly appreciate it if a libxml guru could take a look at it
as I intend to commit this to libxml++.

Thanks in advance,
Thomas




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