Home arrow XML arrow Page 3 - An Introduction to XUL Part 6

Customization - XML

Learn about XUL, a subset of XML used to describe user interfaces, that helps you to make rich user interfaces with nothing more complicated than a text editor. In the sixth part of this series learn about XBL, another of XMLs many faces and a partner in crime with XUL, also called XML Binding Language.

  1. An Introduction to XUL Part 6
  2. Stylesheet
  3. Customization
  4. Adding the Code to our XUL
By: Dan Wellman
Rating: starstarstarstarstar / 10
June 27, 2005

print this article



One of the things that make Mozilla and many other application great is the fact that they are highly customizable through the use of skins to change the appearance of the application, and locales to change the language.  Mozilla manages its skins and locales by packaging them all up into a series of JAR files; look in the application directory of Mozilla and in the chrome directory, you will see these files.  JAR files are compressed archives of stylesheets that handle the appearance of the application, or DTDs that contain all of the text strings in the application.  Both skin and locale archives contain RDF files describe them to Mozilla and all of the JARs are listed in the installed-chrome text file and chrome.rdf files. 

When changing the skin or language of Mozilla, the relevant files are accessed via a chrome URL, and using your skins or locales in this way gives them far more control and flexibility, for example, you can use XBL not just to inherit elements into your XUL files but attributes, properties, methods and event handlers when using chrome URLs in the place of standard path names to reference the XML and CSS files.  You can add a stylesheet in your working directory and modify the skin of any of the examples we have worked on, simply linking the XUL file and the stylesheet using just a standard reference.

In order to use a chrome reference, you need to register the relevant files using an RDF file and tell Mozilla where it is by adding details of its location to the installed-chrome.txt file.  You could alter the appearance of the menu in the created in the previous article.  First of all, create a new folder in the folder you have been working from called mystyle.  Now create a very basic stylesheet, something along the following lines:

menubar {
    color:white ; background-color:red ;

menu {
   color:white ; background-color:maroon ; font-weight:bold ;

menuitem {
   color:white ; background-color:blue ;

Save it as mystle.css in the folder you have just created.  Go back to the Mozilla chrome directory and open the JAR file called classic (you may need a copy winRAR to do this).  In this file will be all of the classic skins for each of the different components of Mozlla; in the location skin\classic\navigator within the JAR file, will be another contents RDF file, copy this to the myskin folder that contains your CSS file.  Now open the RDF file.  It will contain an RDF description of the skin and component it was describing so you need to change all of the references of classic/1.o to mystyle/1.o and change the references of navigator to openclose.   Before you save this file, youll also need to change the two RDF:Seq elements to RDF:Bag elements. 

Once this is done, go back to the Mozilla chrome directory once again and open the installed-chrome.txt file.  At the end of the file, add the following line:


Remember to hit return after adding this line and then save the file.

>>> More XML Articles          >>> More By Dan Wellman

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates


Dev Shed Tutorial Topics: