You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2007/04/02 18:19:33 UTC
svn commit: r524825 - in /apr/apr-util/branches/0.9.x: CHANGES xml/apr_xml.c
Author: jorton
Date: Mon Apr 2 09:19:29 2007
New Revision: 524825
URL: http://svn.apache.org/viewvc?view=rev&rev=524825
Log:
Merge r522630 from trunk:
* 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/branches/0.9.x/CHANGES
apr/apr-util/branches/0.9.x/xml/apr_xml.c
Modified: apr/apr-util/branches/0.9.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/0.9.x/CHANGES?view=diff&rev=524825&r1=524824&r2=524825
==============================================================================
--- apr/apr-util/branches/0.9.x/CHANGES (original)
+++ apr/apr-util/branches/0.9.x/CHANGES Mon Apr 2 09:19:29 2007
@@ -1,6 +1,7 @@
Changes with APR-util 0.9.14
-
+ *) Fix handling of attribute namespaces in apr_xml_to_text() when
+ a namespace map is provided. PR 41908. [Joe Orton]
Changes with APR-util 0.9.13
Modified: apr/apr-util/branches/0.9.x/xml/apr_xml.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/0.9.x/xml/apr_xml.c?view=diff&rev=524825&r1=524824&r2=524825
==============================================================================
--- apr/apr-util/branches/0.9.x/xml/apr_xml.c (original)
+++ apr/apr-util/branches/0.9.x/xml/apr_xml.c Mon Apr 2 09:19:29 2007
@@ -662,7 +662,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;
}
}
@@ -732,8 +733,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;
}