summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2007-03-26 21:19:44 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2007-03-26 21:19:44 +0000
commitc66c9e0b9c4f326420f244bfc4b2d70771d48bcf (patch)
tree0c267401ae22c209a4a92c31777ccca7d1ef9936
parent4bfe5d95b319d3f8217e77f01c6873c432c002a7 (diff)
downloadlibapr-util-c66c9e0b9c4f326420f244bfc4b2d70771d48bcf.tar.gz
* xml/apr_xml.c (elem_size, write_elem): Fix attribute namespace
handling; where applicable, use the mapped namespace index. PR: 41908 git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@522630 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--xml/apr_xml.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xml/apr_xml.c b/xml/apr_xml.c
index 546fcb01..83aff452 100644
--- a/xml/apr_xml.c
+++ b/xml/apr_xml.c
@@ -670,7 +670,8 @@ static apr_size_t elem_size(const apr_xml_elem *elem, int style,
}
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 @@ static char *write_elem(char *s, const apr_xml_elem *elem, int style,
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;
}