jorton 655205
jorton 655205
Author: jorton
jorton 655205
Date: Mon Mar 26 14:19:44 2007
jorton 655205
New Revision: 522630
jorton 655205
jorton 655205
URL: http://svn.apache.org/viewvc?view=rev&rev=522630
jorton 655205
Log:
jorton 655205
* xml/apr_xml.c (elem_size, write_elem): Fix attribute namespace
jorton 655205
handling; where applicable, use the mapped namespace index.
jorton 655205
jorton 655205
PR: 41908
jorton 655205
jorton 655205
--- apr-util-1.2.8/xml/apr_xml.c.xmlns
jorton 655205
+++ apr-util-1.2.8/xml/apr_xml.c
jorton 655205
@@ -666,7 +666,8 @@
jorton 655205
 	    }
jorton 655205
 	    else {
jorton 655205
 		/* compute size of: ' ns%d:%s="%s"' */
jorton 655205
-		size += 3 + APR_XML_NS_LEN(attr->ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1;
jorton 655205
+                int ns = ns_map ? ns_map[attr->ns] : attr->ns;
jorton 655205
+                size += 3 + APR_XML_NS_LEN(ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1;
jorton 655205
 	    }
jorton 655205
 	}
jorton 655205
 
jorton 655205
@@ -736,8 +737,10 @@
jorton 655205
 	for (attr = elem->attr; attr; attr = attr->next) {
jorton 655205
 	    if (attr->ns == APR_XML_NS_NONE)
jorton 655205
 		len = sprintf(s, " %s=\"%s\"", attr->name, attr->value);
jorton 655205
-	    else
jorton 655205
-		len = sprintf(s, " ns%d:%s=\"%s\"", attr->ns, attr->name, attr->value);
jorton 655205
+            else {
jorton 655205
+                ns = ns_map ? ns_map[attr->ns] : attr->ns;
jorton 655205
+                len = sprintf(s, " ns%d:%s=\"%s\"", ns, attr->name, attr->value);
jorton 655205
+            }
jorton 655205
 	    s += len;
jorton 655205
 	}
jorton 655205