fixed xmlReconciliateNs(), added a Python test/example for inter-document
* tree.c python/tests/Makefile.am python/tests/cutnpaste.py:
fixed xmlReconciliateNs(), added a Python test/example for
inter-document cut'n paste
* python/libxml.py: fixed node.doc on document nodes and added
xpathEval() onto node objects
Daniel
diff --git a/tree.c b/tree.c
index 3bd3456..3764f0e 100644
--- a/tree.c
+++ b/tree.c
@@ -4515,11 +4515,18 @@
* Find a close prefix which is not already in use.
* Let's strip namespace prefixes longer than 20 chars !
*/
- sprintf((char *) prefix, "%.20s", ns->prefix);
+ if (ns->prefix == NULL)
+ sprintf((char *) prefix, "default");
+ else
+ sprintf((char *) prefix, "%.20s", ns->prefix);
+
def = xmlSearchNs(doc, tree, prefix);
while (def != NULL) {
if (counter > 1000) return(NULL);
- sprintf((char *) prefix, "%.20s%d", ns->prefix, counter++);
+ if (ns->prefix == NULL)
+ sprintf((char *) prefix, "default%d", counter++);
+ else
+ sprintf((char *) prefix, "%.20s%d", ns->prefix, counter++);
def = xmlSearchNs(doc, tree, prefix);
}
@@ -4721,6 +4728,10 @@
} else
break;
}
+ if (oldNs != NULL)
+ xmlFree(oldNs);
+ if (newNs != NULL)
+ xmlFree(newNs);
return(ret);
}