XML
  Home arrow XML arrow Page 3 - An Introduction to XUL Part 1
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

An Introduction to XUL Part 1
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 21
    2005-05-23

    Table of Contents:
  • An Introduction to XUL Part 1
  • Getting started
  • Follow the rules
  • Adding buttons

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    An Introduction to XUL Part 1 - Follow the rules


    (Page 3 of 4 )

    As XUL is an XML technology, the usual XML syntax rules apply; documents must begin with the XML declaration, all elements should be closed correctly, nested correctly, and so forth. All code, with the exception of string values, should be in lowercase, and the XUL namespace must be declared in the root element. Those used to XML will find the syntax of XUL very easy to get the hang of; in fact, it will sometimes seem intuitive.

    As stated above, you can create a XUL window using just a Notepad style application, so in Notepad, or the text editor of your choice, create your first XUL interface window by typing the following code:

    <?xml version="1.0"?>
    <window
      id="MyFirstWindow" title="My First XUL Window!" width="500"   height="300" screenX="50" screenY="100"   xmlns="
    http://www.mozilla.org/keymaster/gatekeeper/
    there.is.only.xul
    ">
    </window>

    All XUL documents should begin with the XML declaration, and all XUL elements will need to be contained within the window element, which must include the XUL namespace attribute shown above. As with any XML element, there are certain attributes that you can make use of to modify the appearance of the element in question. Here, the code specifies the id (for scripting purposes), the text that appears on the title bar, the dimensions, and where it should appear on screen.

    Now save the file as myFirstWindow.xul, and remember to change the "save as" drop-down to all applications or you’ll just end up with a file called myFirstWindow.xul.txt which won’t do anything interesting at all, even if opened from within Mozilla. Issue the execution command on the command line (Mozilla –chrome file://C:/XULApps/myFirstWindow.xul), and a very plain window should appear. You can make this look a little bit like Mozilla by including the stylesheet reference as follows above the opening window tag:

    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

    Which at this early stage just gives you a kind of grayish background.
    The ref to the CSS file above contains the chrome directory, which forms part of the chrome architecture. The chrome architecture refers to the elements of Mozilla that make up how the interface looks.  Other applications that make use of XUL will also make use of a chrome directory for storing XUL, CSS and RDF files, and when making larger XUL applications, a directory structure that includes a chrome folder is something that you will need to make use of as well. RDF, by the way, stands for Resource Description Framework, and is another W3C recommended XML technology used to describe metadata (information about information).

    More XML Articles
    More By Dan Wellman


       · """I initially tried to do it using the command line method, which failed repeatedly...
       · Thanks for clearing that up for me, I was curious as to why the command line method...
       · Unfortunately, it would seem your advice is flawed. Windows is case-insensitive, so...
       · Hi,I use winxp pro, which does not appear to be case sensitive when adding the...
       · To set the path variable in the autoexec.bat file AND keep previous paths,...
     

       

    XML ARTICLES

    - 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...
    - Practical XML Data Design and Manipulation f...
    - SimpleXML
    - XForms Basics, Part 3
    - XForms Basics, Part 2
    - XForms Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway