unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guile-devel@gnu.org
Subject: Re: sxml simple, sxml->xml and namespaces
Date: Tue, 21 Jun 2016 22:58:36 +0200	[thread overview]
Message-ID: <87r3bquumb.fsf@pobox.com> (raw)
In-Reply-To: <87k2hi1dq5.fsf@elephly.net> (Ricardo Wurmus's message of "Tue, 21 Jun 2016 22:36:18 +0200")

Hi,

On Tue 21 Jun 2016 22:36, Ricardo Wurmus <rekado@elephly.net> writes:

> This is the same patch I sent to the discussion of bug#20339 about a
> year ago.

Yeah sorry for the miscommunication; two lists, split brain.

> The patch is not very ambitious: it only gives the user a way around the
> error by letting them pass an alist of namespaces.  The patched
> “sxml->xml” does not attempt to be smart about anything.  It will still
> fail if it encounters an undeclared namespace.

This sounds fine to me to be honest.

>         ;; Define SVG document with namespaces
>         (define the-svg "<svg xmlns='http://www.w3.org/2000/svg'
>            xmlns:xlink='http://www.w3.org/1999/xlink'>
>         <rect x='5' y='5' width='20' height='20'
>               stroke-width='2' stroke='purple' fill='yellow'
>               id='rect1' />
>         <rect x='30' y='5' width='20' height='20'
>               ry='5' rx='8' stroke-width='2' stroke='purple' fill='blue'
>               xlink:href='#rect1' />
>         </svg>")
>
>         ;; Define alist of namespaces
>         (define ns '((svg . "http://www.w3.org/2000/svg")
>                      (xlink . "http://www.w3.org/1999/xlink")))
>
>         ;; Convert to SXML, abbreviate namespaces according to ns alist
>         (define the-sxml (xml->sxml the-svg #:namespaces ns))
>
>         ;; Convert back to XML
>         (sxml->xml the-sxml #:namespaces ns)
>
>         => <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
>                     xmlns:xlink="http://www.w3.org/1999/xlink">
>              <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" />
>            </svg:svg>

This doesn't seem quite right to me, in the sense that it should be
possible to specify default namespaces (i.e. xmlns=..., not requiring
xmlns:svg=...).  What do you think?  The patch window is wide open :)

Andy



  reply	other threads:[~2016-06-21 20:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 20:55 sxml simple, sxml->xml and namespaces tomas
2016-06-20  8:56 ` Andy Wingo
2016-06-20 10:52   ` Ricardo Wurmus
2016-06-20 11:20     ` tomas
2016-06-20 12:11     ` Andy Wingo
2016-06-21 20:36       ` Ricardo Wurmus
2016-06-21 20:58         ` Andy Wingo [this message]
2016-06-20 11:18   ` tomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3bquumb.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).