[xml] xmlReconciliateNs interface per node


I have a scenario where I am combining xml elements from a number of
documents. The documents are heavily namespaced and it looks
xmlReconciliateNs does not scale well.

It will be nice if xmlReconciliateNs and xmlDOMWrapReconcileNamespaces
are fixed to scale better, but I have an idea for an extremely
straight forward change that also will help me to resolve the problem.

If I have an additional interface xmlReconciliateNodeNs(xmlDocPtr doc,
xmlNodePtr tree, xmlNodePtr node) that I could call per element will
allow me to avoid the scalability problem of xmlReconciliateNs and the
change in the implementation will look as simple as:

--- a/tree.c
+++ b/tree.c
@@ -6247,14 +6247,14 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr
tree, xmlN  * Returns the number of namespace declarations create
d or -1 in case of error.  */
-xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
+xmlReconciliateNodeNs(xmlDocPtr doc, xmlNodePtr tree, xmlNodePtr node) {
     xmlNsPtr *oldNs = NULL;
     xmlNsPtr *newNs = NULL;
     int sizeCache = 0;
     int nbCache = 0;

     xmlNsPtr n;
-    xmlNodePtr node = tree;
     xmlAttrPtr attr;
     int ret = 0, i;

@@ -6426,6 +6426,11 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
+xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
+    return xmlReconciliateNodeNs(doc, tree, tree);

 static xmlAttrPtr

Please let me know is this sounds reasonable or I could do something
else to avoid the problem?


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