FrapMenu menu/item ordering
Brian J. Tarricone
bjt23 at cornell.edu
Thu Feb 22 18:13:35 CET 2007
-----BEGIN PGP SIGNED MESSAGE-----
On Thu, 22 Feb 2007 09:05:16 +0100 Stephan Arts wrote:
>On 2/21/07, Brian J. Tarricone <bjt23 at cornell.edu> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> On Wed, 21 Feb 2007 20:42:36 +0100 Stefan Stuhr wrote:
>> > ons, 21 02 2007 kl. 20:19 +0100, skrev Jannis Pohlmann:
>> > > They're unsorted as the order is unimportant for internal use.
>> > > Comparing them by names is really easy with the help of a
>> > > GCompareFunc as you can see above.
>> > I will admit that I don't know the fd.org menu standard, but if the
>> > implementation in GNOME follows the standard (I do believe that it
>> > does), then the order does matter - and not necessary a sorted
>> > order.
>> Agreed. If FrapMenu can't preserve the order from the .menu file,
>> that's a *huge* limitation. How will people make menus with
>> arbitrarily-ordered items?
>Sorry to disappoint you there, but the XML standard does not force
>siblings to be entered in a specific order. As such, there is no XML
>parser which will guarantee you that xml-nodes are returned in the
>order they come up in the file. And they do not have too, it is not
>part of XML-spec itself.
>As a consequence of this, it is impossible for FrapMenu (or any other
>application which uses XML) to preserve the order since it is not even
>certain that the order in which the nodes are presented to him is the
>order in which they where inside the file.
>On a side-node, usually it does work this way, but we cannot rely on
Er, are you aware of any XML parsers that *don't* return them in
order? libxml2 and the gmarkup parser both do, last I checked, and I
can't see why a parser wouldn't do this.
Regardless: if it is not possible to specify a strict ordering of the
menu -- whether a limitation of XML itself, or in the menu spec -- I
consider the spec broken. The menu spec's <Layout> element (when
Jannis implements support for it) should work fine, though it *does*
functionally depend on the XML parser returning elements in order.
If what you say is true, I can think of several other popular
applications that use XML for ordered lists; I'd be very surprised to
find out that that method ever breaks.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Xfce4-dev