unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jan Synacek <jsynacek@redhat.com>
To: 41320@debbugs.gnu.org
Subject: bug#41320: sxml attributes of some elements are in reverse order
Date: Sat, 16 May 2020 12:29:54 +0200	[thread overview]
Message-ID: <m6fimgw6ul9.fsf@jsynacek-ntb.brq.redhat.com> (raw)

Consider the following code snippet running on Guile-3.0.2:

(use-modules (sxml simple)
	     (sxml xpath))

(define doc
  (call-with-input-file "/home/jsynacek/src/xcb-proto-1.13/src/xproto.xml"
    (lambda (port)
      (xml->sxml port))))
      
(define events ((sxpath '(// event)) doc))

(display (car events))
(newline)

Now, attributes of *some* elements are generated in reverse order,
which makes the output pretty much undeterministic and using sxml-match
unreliable.

This is from the original xml:

  <event name="KeyPress" number="2">
    <field type="KEYCODE" name="detail" />
    <field type="TIMESTAMP" name="time" />
    <field type="WINDOW" name="root" />
  ...

And the resulting sxml:

  (event (@ (number 2) (name KeyPress)) 
     (field (@ (type KEYCODE) (name detail))) 
     (field (@ (type TIMESTAMP) (name time))) 
     (field (@ (type WINDOW) (name root))) 
  ...

Attributes 'number' and 'name' are in reverse compared to the original
xml. On the other hand, 'type' and 'name' of the 'field' element are in
correct order.

The xproto.xml file comes from xcb-proto [1].

[1] https://lists.freedesktop.org/archives/xcb/2018-March/011090.html






             reply	other threads:[~2020-05-16 10:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16 10:29 Jan Synacek [this message]
2020-05-16 11:02 ` bug#41320: sxml attributes of some elements are in reverse order tomas
2020-05-16 12:27   ` Jan Synacek
2020-05-16 12:30     ` Linus Björnstam
2020-05-16 12:50       ` Jan Synacek
2020-05-16 14:21     ` 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=m6fimgw6ul9.fsf@jsynacek-ntb.brq.redhat.com \
    --to=jsynacek@redhat.com \
    --cc=41320@debbugs.gnu.org \
    /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).