Home arrow XML arrow Page 2 - Back to XUL: Uniting XUL and RDF
XML

Back to XUL: Uniting XUL and RDF


In the previous article in this series, we put together the main interface file. Before you can see how it will look, however, you need to describe it in a language that Mozilla can understand. This article will show you how to create the appropriate RDF file, register it with Mozilla's chrome directory, and in general get to the point where you can see the fruits of your labors over the previous two articles.

Author Info:
By: Dan Wellman
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
January 30, 2006
TABLE OF CONTENTS:
  1. · Back to XUL: Uniting XUL and RDF
  2. · The Registration Process
  3. · Linking the DTD to the XUL File
  4. · Tell the Interface What to Do

print this article
SEARCH DEVARTICLES

Back to XUL: Uniting XUL and RDF - The Registration Process
(Page 2 of 4 )

Now for the registration process. If you had used plain text labels throughout your file, you would be able to open this file in Mozilla in a kind of low privilege, view only mode.  It would be opened using the standard File Open method, but as a chrome URL has not been used, it would not have file system access or anything like that. 

To register your file with Mozilla then, you need to browse to the Mozilla chrome directory (C:\Program Files\mozilla.org\Mozilla\chrome) and find a file called installed-chrome.txt.  Even though this is a simple text file, it will look a little odd when viewed in Notepad, so I would recommend using something a little more powerful (I use a fantastic freeware application called nPad2). 

So open the file and you will see basically a list of all of the chrome that makes up the Mozilla interface.  Go to the end of the file and add the following instruction:

content,install,url,file:///C|/XUL/XULEditLite/Content/

If you have saved the interface file in another location, adjust the above line of code accordingly.  Also, make sure that you hit the return key after entering the final forward-slash.

Also in the chrome folder is a file called chrome.rdf which you need to delete.  Now open Mozilla, and this file will reappear in the chrome directory.  Provided you entered the above instruction correctly, you should be able to find a section in the chrome.rdf file describing the Interface file we have created.  This will denote successful registration of the interface file. 

 

There still remains something that needs to be done, however, before we can finally view our interface.  We need to make, and register, the DTD file.

Open a new file in your text editor and begin once more with the XML declaration:

<?xml version="1.0"?>

Now for each of the entity references from the interface file, you need to add an entity declaration:

<!ENTITY fileLabel "File">

This is an easy file to code. As the example shows, you declare each entity using the !ENTITY keyword followed by the entity reference name, followed by the string you want displayed double-quoted.  Easy.  Now for the rest of the file:

<!ENTITY openLabel "Open">
<!ENTITY closeLabel "Close">
<!ENTITY saveLabel "Save">
<!ENTITY newLabel "New">
<!ENTITY xulLabel "XUL File">
<!ENTITY htmLabel "HTML File">
<!ENTITY xmlLabel "XML File">
<!ENTITY exitLabel "Exit">
<!ENTITY editLabel "Edit">
<!ENTITY copyLabel "Copy">
<!ENTITY pasteLabel "Paste">
<!ENTITY cutLabel "Cut">
<!ENTITY helpLabel "Help">
<!ENTITY helpContentsLabel "Help Contents">
<!ENTITY aboutLabel "About">
<!ENTITY toolbarsTooltip "Insert Bar Element">
<!ENTITY menubaLabel "Insert menubar">
<!ENTITY toolbarLabel "Insert toolbar">
<!ENTITY toolbarButtonLabel "Insert toolbar button">
<!ENTITY menuseparatorLabel "Insert menu seperator">
<!ENTITY formsTooltip "Insert Form Element">
<!ENTITY textboxLabel "Insert textbox">
<!ENTITY listboxLabel "Insert list box">
<!ENTITY radioLabel "Insert radio button">
<!ENTITY windowsTooltip "Insert Window Element">
<!ENTITY windowLabel "Insert window">
<!ENTITY wizardLabel "Insert wizard">
<!ENTITY editorLabel "Insert editor">
<!ENTITY browserLabel "Insert browser">
<!ENTITY iframeLabel "Insert iframe">
<!ENTITY titlebarLabel "Insert titlebar">

This file should be saved with a .dtd extension in the en-US folder.  The file name should match the filename of the main XUL file, in this case, interface.dtd.  There will be more text strings to add to this file at some point in the future, as we will need to add the text this is displayed in the help pop-up, but we can add that later, once we have coded the additional window itself.

Now, the final step before we are able to take a look at the fruits of our labor is to register the DTD and link it to the XUL file.


blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials