DTDs and other fun



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.

Now, we can actually properly validate using RELAX NG. I've attached
RELAX NG schemas in both the XML and the compact syntaxes. XML is the
only syntax understood by 'xmllint --relaxng'. Compact syntax is more
readable for humans, and it's understood by emacs nxml-mode to give
you validation on the fly. See this page for tips on that:

https://fedoraproject.org/wiki/How_to_use_Emacs_for_XML_editing

--
Shaun

Attachment: gtkbuilder.dtd
Description: application/xml-dtd

Attachment: gtkbuilder.rnc
Description: application/relax-ng-compact-syntax

Attachment: gtkbuilder.rng
Description: XML document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]