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