applied patch from Aleksey Sanin fixing a problem in the canonicalization
* c14n.c: applied patch from Aleksey Sanin fixing a problem in the
canonicalization algorithm
* doc/xml.html doc/index.html: added the C14N references on the
index page.
Daniel
diff --git a/c14n.c b/c14n.c
index 7aab539..27e25b8 100644
--- a/c14n.c
+++ b/c14n.c
@@ -266,8 +266,9 @@
xmlNsPtr ns;
xmlListPtr list;
xmlNodePtr visible_parent;
+ xmlNodePtr node;
xmlNsPtr prev;
-
+
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
#ifdef DEBUG_C14N
xmlGenericError(xmlGenericErrorContext,
@@ -302,6 +303,7 @@
* defined in node parents). By this we need to now walk thru
* all namespace in current node and all invisible ancesstors
*/
+ node = cur;
while (cur != visible_parent) {
for (ns = cur->nsDef; ns != NULL; ns = ns->next) {
/*
@@ -311,6 +313,11 @@
if ((xmlC14NIsXmlNs(ns)) || (xmlListSearch(list, ns) != NULL)) {
continue;
}
+ prev = xmlSearchNs(ctx->doc, node, ns->prefix);
+ if(prev != ns) {
+ /* we already processed a namespace with this name */
+ continue;
+ }
/*
* Lookup nearest namespace after visible parent having