[xml] Removing a namespace declaration



Hi,

my XML diff copies input XML documents to a new document, using elements in a 
"reserved" namespace to annotate the resulting tree. The namespace is 
declared in the document element, but usually gets duplicated in a few other 
places (apparently it's copied from sub-tree diffs). To keep the diff small, 
I'd like to remove these duplicates. Is there a specific libxml function to 
remove a namespace declaration from xmlNodePtr?

I couldn't find any such function, so I wrote the (reasonably obvious) code 
updating the linked list starting at xmlNodePtr->nsDef to remove the unwanted 
xmlNsPtr. But I don't know when to free it - calling xmlFreeNs on it makes my 
program crash. How are the namespaces organized - for example, why are there 
2 lists (ns and nsDef) of namespaces in a node?

        Bye
                Vasek




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