XUL Is XML
Simplicity is a chief attraction of XML. When a suitable set of tags are available for a given problem domain, solutions in that domain can be expressed very neatly. For example, in the Structured Vector Graphics (SVG) XML application, a programmer can specify a circle simply with the <circle> tag.
XUL doesn't have a URL that contains a definition of all the existing tagsthis fake URL is used instead:
<window> is XUL's equivalent of HTML's <html> tag.
Before XML, expressing a software GUI required either a "canned" approach, in which a GUI design tool does all the work for you, or a heap of code written in some programming language. XUL uses neither of these strategies. Instead, each widget in the GUI is declared with one or more XUL tags, a strategy identical to that of HTML. For GUIs, this is an efficient and groundbreaking way to do software development. XUL is also designed so the same code will work across all platforms. Thus, your XUL document will display correctly on Microsoft Windows, Macintosh, and Linux.
The Mozilla platform and products derived from it, such as AOL for the Macintosh, Oeone's HomeBase, and Netscape, can all display XUL content. The platform can do this directly, without the use of any additional application. For example, Figures 1 and 2 show an ordinary XHTML page displayed first inside a Mozilla browser window (Figure 1), and secondly all by itself (Figure 2).
Figure 1 XHTML page displayed in a browser.
Figure 2 XHTML page displayed in a raw Mozilla window.
The second window displays a pure XHTML document; the first window is a normal browser window that consists of XUL plus the displayed XHTML. The browser menus, scrollbars, and buttons are made up of one or more XUL documents. Those buttons don't come from compiled code, and they're not somehow "special." They're just XUL tags made visible.
To display an XHTML, XUL, or XML document by itself, just use Mozilla's -chrome command-line option. For example, on Microsoft Windows, try this from the directory in which Mozilla is installed:
mozilla -chrome "http://www.yahoo.com/index.html"
window.open(URL, "_blank", "chrome=true");
Instead of leaving the XUL out, you can leave the XHTML out. A displayed window is then pure XUL, with no HTML. That window can be the basis of a whole application GUI, or of a humble dialog box. When you do that, you're stepping away from the HTML-centric style that lies behind most current web-based application development. For example, the Bookmark Manager window is written entirely in XUL (see Figure 3).
Figure 3 Mozilla's Bookmark Manager is written in XUL.
No 3GL code is required, although a drop of scripting goes a long way. This kind of window lets you break into the world of real application development. Time-efficient web-based skills can be applied to the world of real applicationsyou don't have to learn C++ or even Visual Basic. It's all XML in the end.