From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.lisp.guile.bugs Subject: bug#20339: Taking a step back (was: sxml simple: sxml->xml mishandles namespaces?) Date: Fri, 3 May 2019 12:46:27 +0200 Message-ID: <20190503104627.GE31083@tuxteam.de> References: <20150415194714.GA30295@tuxteam.de> <87y45vln0f.fsf@pobox.com> <20160713132403.GA2349@tuxteam.de> <87furc1qeu.fsf@pobox.com> <87a7jbi8rx.fsf@elephly.net> <20190212095602.GD13448@tuxteam.de> <87wom4iwc3.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="imjhCm/Pyz7Rq5F2" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="19827"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: 20339@debbugs.gnu.org To: Ricardo Wurmus Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri May 03 23:19:12 2019 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMfaK-0012u5-2m for guile-bugs@m.gmane.org; Fri, 03 May 2019 23:19:12 +0200 Original-Received: from localhost ([127.0.0.1]:37980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMVif-00080D-BY for guile-bugs@m.gmane.org; Fri, 03 May 2019 06:47:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMVia-000807-9r for bug-guile@gnu.org; Fri, 03 May 2019 06:47:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMViY-00045c-Mo for bug-guile@gnu.org; Fri, 03 May 2019 06:47:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34283) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMViY-00045N-9h for bug-guile@gnu.org; Fri, 03 May 2019 06:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hMViY-0000SU-5l for bug-guile@gnu.org; Fri, 03 May 2019 06:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: tomas@tuxteam.de Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 03 May 2019 10:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20339 X-GNU-PR-Package: guile Original-Received: via spool by 20339-submit@debbugs.gnu.org id=B20339.15568803991733 (code B ref 20339); Fri, 03 May 2019 10:47:02 +0000 Original-Received: (at 20339) by debbugs.gnu.org; 3 May 2019 10:46:39 +0000 Original-Received: from localhost ([127.0.0.1]:47827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMViA-0000Rr-JF for submit@debbugs.gnu.org; Fri, 03 May 2019 06:46:39 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:36828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMVi5-0000Rf-PQ for 20339@debbugs.gnu.org; Fri, 03 May 2019 06:46:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=JsUyCYj5dp82jov8QJTMxBPXPEXdwUHlTIQYdfEpU+E=; b=l7AiYLeYETz7SyflbCLPIbNsDFf6JM41FkZjcbfshK++mwhT7RGL9flGapjF2b9dCLUSO9szcgoyxfdMXuF+ui9eTZlVP4LhBHZTxB9JiYxfrAalINzkp/4r4Dlrgh5ikwi3klo7Rs/s44ecP2F/ltsWXeKoNZwP0U90r5FMkUWfjbluHvu+pIz3ORlLnzpOz8HFEhBCFqSpWztzW50rhECHfSuqSdbYK6X+EViO8Ia0Qy6dUtX10vHLsDOVJgMc331Il0gaTm2rlefd/XLiCyv/7i1MYmaD+vAA8/PBHpiKJCHqiCDQ8vYXIb5N4eoNTzB/Lse3wsgD5UmA8vejMw==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1hMVhz-0001i0-Ci; Fri, 03 May 2019 12:46:27 +0200 Content-Disposition: inline In-Reply-To: <87wom4iwc3.fsf@elephly.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.lisp.guile.bugs:9326 Archived-At: --imjhCm/Pyz7Rq5F2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, after mulling over it for a while, I think it's time to take a step back and think a bit about where we'd like to go with this. Note that I'm ignoring technical details (the fact that the SXML, and thus the XML serialization now has namespace declarations everywhere down the path instead of just at the corresponding root node, and the thing with the default namespaces, as noted in [1], seem to me "fixable" technical details). Your patch, Ricardo, takes a new approach wrt. the SXML resulting =66rom an XML parse: the full tag names (the QNAMEs, in XML parlance) are now composed of : (mimicking the XML) instead of :, as the former (sxml simple) used to do. This has upsides and downsides. I'll call your approach the "prefix" approach (as having the prefixes to qualify the tag names) and the approach followed by (sxml simple) up to now the "URI" approach, which haves the full namespace URI qualifying the name. In the URI approach, a qualified tag name would look like "http://example.org/namespaces/myns:node" whereas in the prefix approach, it'd look like "myns:root" plus the knowledge somewhere that the prefix "myns" stands for myns -> http://example.org/namespaces/myns Upsides of the prefix approach: + it mimics more closely the XML syntax. Since that is what the XML folks see, that follows the "principle of least astonishment" (aka POLA) + it is forced to keep the prefix -> namespace associations (it would be semantically incomplete if not, since what counts semantically is the namespace URI) Downsides - it contradicts current documentation "All namespaces in the XML document must be declared, via xmlns attributes. SXML elements built from non-default namespaces will have their tags prefixed with their URI. Users can specify custom prefixes for certain namespaces with the #:namespaces keyword argument to xml->sxml." [2] This can be changed, of course :-) But perhaps someone is already relying on it? - working on the resulting SXML becomes harder, because to compare two qualified names, we'd have to resolve the namespace associations. Upsides of the URI approach + it is what the documentation says + it follows more closely the XML semantics (the namespace prefix in itself is irrelevant after all). As a corollary, working on the SXML becomes easier: a comparison of two qualified names becomes a simple string comparison, etc. I think that is why (sxml simple)'s original design followed this path. Downsides Well, negate the "prefix approach" upsides :-) Let me just say that there seem to be precedents for the prefix approach out there in the 'net: the Wikipedia article [3] (yes, there's a wikipedia on that!) follows the prefix approach. This nice blog post [4] too. I think I'll stop here. Mi fingers itch with some hacking, but I think we should pause and ponder before hacking. Perhaps we should take this to guile-devel? OTOH, if someone knows The Way Forward (TM), I'm willing to hack in this direction. Cheers & thanks [1] Message ID <20190408121403.GA781@tuxteam.de> http://lists.gnu.org/archive/html/bug-guile/2019-04/msg00001.html [2] https://www.gnu.org/software/guile/manual/guile.html#SXML [3] https://en.wikipedia.org/wiki/SXML [4] https://www.more-magic.net/posts/lispy-dsl-sxml.html -- tom=C3=A1s --imjhCm/Pyz7Rq5F2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlzMHAMACgkQBcgs9XrR2karLACdFBBbZnzvLF3kxFuyGiO1LdFl 7a8An3REZ122yhfCev5iLBMuQTKWSwMH =m2+q -----END PGP SIGNATURE----- --imjhCm/Pyz7Rq5F2--