Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 70726 invoked from network); 26 Mar 2007 21:20:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2007 21:20:06 -0000 Received: (qmail 37589 invoked by uid 500); 26 Mar 2007 21:20:13 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 37489 invoked by uid 500); 26 Mar 2007 21:20:13 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 37478 invoked by uid 99); 26 Mar 2007 21:20:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 14:20:13 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 14:20:05 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 4D7DC1A9838; Mon, 26 Mar 2007 14:19:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r522630 - /apr/apr-util/trunk/xml/apr_xml.c Date: Mon, 26 Mar 2007 21:19:45 -0000 To: commits@apr.apache.org From: jorton@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070326211945.4D7DC1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }