FrapMenu menu/item ordering
Jannis Pohlmann
jannis at xfce.org
Thu Feb 22 20:11:08 CET 2007
On Thu, 22 Feb 2007 12:42:38 -0500, Erik Harrison wrote:
> On 2/22/07, Brian J. Tarricone <bjt23 at cornell.edu> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > 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 this.
> >
> > 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.
>
> Like XHTML? If the nodes were unordered. Oh man. That would be awesome
Exactly what I was thinking about as well. Even from the technical point
of view this makes sense. I mean, IO methods return chracters in order,
so a parser usually would read element by element from the top to the
bottom of the file. It would be strange if during that elements were
randomly inserted into the XML tree in memory.
Don't worry about XML element order - you'll get the layout
capabilities you need anyway, sooner or later.
- Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20070222/4f0bc6ad/attachment.pgp>
More information about the Xfce4-dev
mailing list