unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#41320: sxml attributes of some elements are in reverse order
@ 2020-05-16 10:29 Jan Synacek
  2020-05-16 11:02 ` tomas
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Synacek @ 2020-05-16 10:29 UTC (permalink / raw)
  To: 41320

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






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

end of thread, other threads:[~2020-05-16 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16 10:29 bug#41320: sxml attributes of some elements are in reverse order Jan Synacek
2020-05-16 11:02 ` 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

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