Re: DTDs and other fun
- From: Shaun McCance <shaunm gnome org>
- To: Matthias Clasen <matthias clasen gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: DTDs and other fun
- Date: Thu, 26 Jan 2012 17:30:56 -0500
On Thu, 2012-01-26 at 17:01 -0500, Matthias Clasen wrote:
> On Thu, Jan 26, 2012 at 3:25 PM, Shaun McCance <shaunm gnome org> wrote:
> > Ryan asked me to look at the DTDs for the menu markup and GtkBuilder
> > interface definitions, since he merged everything over to GtkBuilder.
> > Here's the old menumarkup.dtd:
> >
> > http://git.gnome.org/browse/glib/tree/gio/menumarkup.dtd?id=4e9f59bff8adc59fd8fde5bdee9879b8c3e4e55b
> >
> > And here's what our docs say the current GtkBuilder DTD is, though
> > we don't have a separate DTD file.
> >
> > http://developer.gnome.org/gtk3/3.3/GtkBuilder.html#BUILDER-UI
> >
> > Issues:
> >
> > 1) The GtkBuilder DTD doesn't specify attribute types in ATTLIST
> > declarations, so it's invalid.
> >
> > 2) You can't just use ANY anywhere to mean ANY. You either use ANY,
> > or you use an element pattern.
> >
> > 3) If you use ANY, DTDs still try to validate those contents, and
> > that just doesn't work because we can't specify every last element
> > name somebody might use.
> >
> > In short, it is impossible to properly validate these files using
> > DTDs. I've attached a DTD that will validate only those files that
> > don't use any extensions. That at least serves as a sort of loose
> > description of the format.
>
> The fact that nobody ever reported the missing attribute types
> probably shows you how important it is in practical terms for us to
> ship a technically valid DTD... nobody is using this dtd for
> anything.
I mostly agree with that. It certainly means nobody is validating
these files at build/install time. The question is, "should they?"
People don't usually put that stuff in their Makefiles unless you
make it easy for them. It comes down to whether there's a high rate
of invalid .ui files being installed. I kind of suspect no, because
they're almost always machine-generated. With menu files written
(for now) by hand, that might be different.
Of course, having an invalid DTD in the docs (and another one for
GtkUIManager, incidentally) isn't good. If nobody cares about the
DTD per se, maybe we should look at less 1980s ways of conveying
the grammar.
--
Shaun
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]