apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r522630 - /apr/apr-util/trunk/xml/apr_xml.c
Date Mon, 26 Mar 2007 21:19:45 GMT
Author: jorton
Date: Mon Mar 26 14:19:44 2007
New Revision: 522630

URL: http://svn.apache.org/viewvc?view=rev&rev=522630
Log:
* xml/apr_xml.c (elem_size, write_elem): Fix attribute namespace
handling; where applicable, use the mapped namespace index.

PR: 41908

Modified:
    apr/apr-util/trunk/xml/apr_xml.c

Modified: apr/apr-util/trunk/xml/apr_xml.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/xml/apr_xml.c?view=diff&rev=522630&r1=522629&r2=522630
==============================================================================
--- apr/apr-util/trunk/xml/apr_xml.c (original)
+++ apr/apr-util/trunk/xml/apr_xml.c Mon Mar 26 14:19:44 2007
@@ -670,7 +670,8 @@
 	    }
 	    else {
 		/* compute size of: ' ns%d:%s="%s"' */
-		size += 3 + APR_XML_NS_LEN(attr->ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value)
+ 1;
+                int ns = ns_map ? ns_map[attr->ns] : attr->ns;
+                size += 3 + APR_XML_NS_LEN(ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value)
+ 1;
 	    }
 	}
 
@@ -740,8 +741,10 @@
 	for (attr = elem->attr; attr; attr = attr->next) {
 	    if (attr->ns == APR_XML_NS_NONE)
 		len = sprintf(s, " %s=\"%s\"", attr->name, attr->value);
-	    else
-		len = sprintf(s, " ns%d:%s=\"%s\"", attr->ns, attr->name, attr->value);
+            else {
+                ns = ns_map ? ns_map[attr->ns] : attr->ns;
+                len = sprintf(s, " ns%d:%s=\"%s\"", ns, attr->name, attr->value);
+            }
 	    s += len;
 	}
 



Mime
View raw message