Poking Around Inside Mozilla
To use the bottom-up approach, you must first understand Mozilla's implementation of and use of the W3C's RDF standard. The overlayinfo database and the files that contribute information toward that database are recorded in RDF format. Understanding that standard is another article entirely, but it's possible to go some way just by copying the syntax of existing RDF files.
A starting point for those too hasty to learn RDF is to explore the install area of your Mozilla browser a bit. If you experimentally modify .rdf files in there, be very, very careful that your changes are valid XML and meaningful to Mozilla. Many, many files are supplied with every Mozilla installation, and most of those files are human-readable plain text files. For English speakers, they're in UTF8 format, which is a superset of ASCII. The install area containing these files is structured as follows.
Inside the topmost install directory (such as C:\Program Files\Mozilla) is a chrome directory, which holds all of the overlays and the overlayinfo database. There's only one chrome directory for each installation of the Mozilla platform, but that chrome directory may hold many different applications. For example, Netscape 7.0 has Navigator, Messenger, and Composer applications, although their internal names are navigator, messenger, and editor.
Application files can appear in an exposed directory structure underneath the chrome directory, or they can appear as compressed archives. Such archives have a .jar extension. These files are in zip format and can be opened with tools such as WinZip.
To see examples of top-down overlays, just look for any file with the .xul extension and the word overlay in the base name. A name like fooOverlay.xul is a convention designed to remind you that the file is an overlay, and not a complete XUL document in its own right. To see use of the <?xul-overlay?> processing instructions, you'll have to look through the other .xul files. A particularly good example is the file navigator.xul, which can be found in the archive comm.jar (or browser.jar).
Examples of bottom-up overlays are easier to view, but harder to understand. The source files for the overlay database are named contents.rdf, but they're mostly hidden inside .jar files. More easily seen are the overlays.rdf filesgenerated files holding the rules that make up the overlayinfo database. Look in the overlayinfo directory for these files. For example, the file chrome/overlayinfo/navigator/content/overlays.xul shows all the XUL overlays that contribute content to the XUL that makes up the menus and buttons of an everyday Mozilla web browser.