bug#41320: sxml attributes of some elements are in reverse order

Jan Synacek <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.