From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ricardo Wurmus Newsgroups: gmane.lisp.guile.bugs Subject: bug#20339: sxml simple: sxml->xml mishandles namespaces? Date: Tue, 21 Apr 2015 11:24:03 +0200 Message-ID: <87oamh25sc.fsf@mango.localdomain> References: <20150415194714.GA30295@tuxteam.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1429608330 20937 80.91.229.3 (21 Apr 2015 09:25:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Apr 2015 09:25:30 +0000 (UTC) Cc: 20339@debbugs.gnu.org To: tomas@tuxteam.de Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Apr 21 11:25:18 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YkUQZ-0007n7-S3 for guile-bugs@m.gmane.org; Tue, 21 Apr 2015 11:25:11 +0200 Original-Received: from localhost ([::1]:56982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkUQZ-0006Nb-4F for guile-bugs@m.gmane.org; Tue, 21 Apr 2015 05:25:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkUQU-0006Il-Ru for bug-guile@gnu.org; Tue, 21 Apr 2015 05:25:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkUQR-0000gw-Jd for bug-guile@gnu.org; Tue, 21 Apr 2015 05:25:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkUQR-0000gm-Fb for bug-guile@gnu.org; Tue, 21 Apr 2015 05:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YkUQQ-00070E-RH for bug-guile@gnu.org; Tue, 21 Apr 2015 05:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 21 Apr 2015 09:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20339 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 20339-submit@debbugs.gnu.org id=B20339.142960825926865 (code B ref 20339); Tue, 21 Apr 2015 09:25:02 +0000 Original-Received: (at 20339) by debbugs.gnu.org; 21 Apr 2015 09:24:19 +0000 Original-Received: from localhost ([127.0.0.1]:34180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YkUPi-0006zF-S1 for submit@debbugs.gnu.org; Tue, 21 Apr 2015 05:24:19 -0400 Original-Received: from sender1.zohomail.com ([74.201.84.162]:52621) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YkUPe-0006z2-Or for 20339@debbugs.gnu.org; Tue, 21 Apr 2015 05:24:17 -0400 Original-Received: from localhost (141.80.115.59 [141.80.115.59]) by mx.zohomail.com with SMTPS id 1429608247649710.8344961909249; Tue, 21 Apr 2015 02:24:07 -0700 (PDT) In-reply-to: <20150415194714.GA30295@tuxteam.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7772 Archived-At: Hi Tomás, tomas@tuxteam.de writes: > When transforming SXML to XML, namespaces don't seem to be handled > properly: > [...] > > The problem is that SXML used the concatenated (full) namespace with the > name as tag (and attribute) names for namespaced items. When serializing > to XML it should try to find abbreviations for those namespaces and issue > the corresponding namespace declarations. > > Instead, sxml->xml tries to split the (namespace:name) combination > at the first colon and to check the name -- and fails miserably at > (namespace:name) combinations à la "http://www.w3.org/1999/xlink:href" > (procedure check-name). Since there are two colons, the name part > has now a colon. xml->sxml has an optional #:namespaces argument, where you can pass an alist of keys to URLs to be used in the sxml output: (let* ((ns '((svg . "http://www.w3.org/2000/svg") (xlink . "http://www.w3.org/1999/xlink"))) (the-sxml (xml->sxml the-svg #:namespaces ns))) (display the-sxml)) => (*TOP* (svg:svg (svg:rect (@ (y 5) (x 5) (width 20) (stroke-width 2) (stroke purple) (id rect1) (height 20) (fill yellow))) (svg:rect (@ (xlink:href #rect1) (y 5) (x 30) (width 20) (stroke-width 2) (stroke purple) (ry 5) (rx 8) (height 20) (fill blue))))) Passing this to sxml->xml yields: Unfortunately, sxml->xml will not replace the namespace abbreviations, nor will it add appropriate xmlns attributes, so "svg" and "xlink" are devoid of any meaning. Since xml->sxml accepts a namespace alist I suppose it would make sense to extend sxml->xml to do the same. ~~ Ricardo