unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#20339: sxml simple: sxml->xml mishandles namespaces?
@ 2015-04-15 19:47 tomas
  2015-04-20  7:45 ` bug#20339: [PATCH] sxml->xml and namespaces: updated patch tomas
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: tomas @ 2015-04-15 19:47 UTC (permalink / raw)
  To: 20339

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I posted more details on guile-devel. Perhaps this was the wrong list?

When transforming SXML to XML, namespaces don't seem to be handled
properly:


  #!/usr/bin/guile -s
  !#
  (use-modules (sxml simple))
  
  ;; An XML with two namespaces (one default)
  (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>")
  
  ;; Note how SXML handles QNames (just concatenating NS and
  ;; local-name with a colon):
  (define the-sxml
    (with-input-from-string the-svg xml->sxml))
  (format #t "~A\n" the-sxml)
  
  ;; If we try to serialize this: kaboom!
  (sxml->xml the-sxml)

The parsing into SXML goes well, the (format ...) outputs what
I'd expect. But the (sxml->xml ...) dies with:

  ERROR: In procedure scm-error:
  ERROR: Invalid QName: more than one colon http://www.w3.org/2000/svg:svg

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.

There are more details at:

http://lists.gnu.org/archive/html/guile-devel/2015-04/msg00000.html

with a first attempt at a patch against guile (GNU Guile) 2.0.5-deb+1-3.
I'm more than willing to beat the patch into shape, but will possibly
need some guidance. Perhaps I'd need to sign papers with the FSF, which
I'd gladly do.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlUuwEIACgkQBcgs9XrR2kbJWQCfQ/ALFQrf0crOK47SbaOlJlMv
MwAAn3fxDBWOhgNF0L7E35k0skol2T0V
=FIId
-----END PGP SIGNATURE-----





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-05-03 10:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-15 19:47 bug#20339: sxml simple: sxml->xml mishandles namespaces? tomas
2015-04-20  7:45 ` bug#20339: [PATCH] sxml->xml and namespaces: updated patch tomas
2015-04-21  9:24 ` bug#20339: sxml simple: sxml->xml mishandles namespaces? Ricardo Wurmus
2015-04-21  9:44   ` tomas
2015-04-22 14:29     ` Ricardo Wurmus
2015-04-23  6:57       ` tomas
2015-04-23  7:04         ` Ricardo Wurmus
2015-04-23  7:40           ` tomas
2015-04-25 20:25       ` tomas
2015-04-26 10:28         ` tomas
2016-06-23 19:32 ` Andy Wingo
2016-07-13 13:24   ` tomas
2016-07-13 18:08     ` tomas
2016-07-14 10:10     ` Andy Wingo
2016-07-14 10:26       ` tomas
2019-02-04 20:44       ` Ricardo Wurmus
2019-02-04 22:55         ` John Cowan
2019-02-05  9:12           ` Ricardo Wurmus
2019-02-05 12:57             ` Ricardo Wurmus
2019-04-08 12:14               ` tomas
2019-02-12  9:56         ` tomas
2019-02-12 20:30           ` Ricardo Wurmus
2019-05-03 10:46             ` bug#20339: Taking a step back (was: sxml simple: sxml->xml mishandles namespaces?) tomas

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).