XML
  Home arrow XML arrow Page 2 - An Introduction to XUL Part 4
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
XML

An Introduction to XUL Part 4
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2005-06-13


    Table of Contents:
  • An Introduction to XUL Part 4
  • Using the RDF/XML Syntax
  • Creating the Wizard
  • Adding to the installed-chrome.txt file

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    An Introduction to XUL Part 4 - Using the RDF/XML Syntax
    ( Page 2 of 4 )

     

    To store RDF in a file that applications are able to use, you need to use the RDF/XML syntax. There are other implementations, such as N3, but RDF/XML works very well with Mozilla and may appeal to those of you that have some XML experience. As we’ve been discussing RDF already, we will begin by creating the RDF/XML file, although in reality, it would probably be the XUL file that you would create first. Nevertheless, in a text editor, begin again with the XML declaration:

    <?xml version="1.0"?>

    This is not strictly necessary, but should be included for well-formedness. Next, you need to add the RDF container with some namespace properties and the RDF and chrome namespaces:

    <RDF:RDF xmlns:RDF="http://www.w3.org/1999/
             02/22-rdf-syntax-ns#"
             xmlns:chrome="http://www.mozilla.org/rdf/chrome#">

    Next you need to tell Mozilla that you’re describing a list of your applications:

    <RDF:Bag about="urn:mozilla:package:root">

    I have placed this in a bag container, which is standard RDF syntax for an unordered list. If I wanted to create an ordered list, it would be an <RDF:Seq> sequence.  Your application is then defined as an item of the list:

    <RDF:li resource="urn:mozilla:package:mywizard"/>
    </RDF:Bag>

    You now need to provide a description of your application:

    <RDF:Description about="urn:mozilla:package:mywizard"
              chrome:displayName="Wizard"
              chrome:author="Dan Wellman"
              chrome:name="mywizard"
              chrome:version="1.0"/>

    Once this has been added, you need to close off the RDF container:

    </RDF:RDF>

    And save the file as contents.rdf in the same folder that your wizard application will reside in. This can be any folder, but I would recommend creating a chrome folder in your XUL folder and saving both the RDF and the wizard files in that. 

    You might be wondering how you could use this file to describe two XUL files. No? Well I’ll tell you how anyway, because sooner or later, you will want to know.  It’s simple; all you do is add a second block of code similar to the first, but with the filename of your second XUL file. Then whole file would look like this:

    <?xml version="1.0"?>
    <RDF:RDF xmlns:RDF="http://www.w3.org/1999/
             02/22-rdf-syntax-ns#"
             xmlns:chrome="http://www.mozilla.org/rdf/chrome#">

    <RDF:Bag about="urn:mozilla:package:root">
      <RDF:li RDF:resource="urn:mozilla:package:fredswizard"/>
    </RDF:Bag>

    <RDF:Description about="urn:mozilla:package:fredswizard"
              chrome:displayName="Freds Wizard"
              chrome:author="Fred"
              chrome:name="fredswizard"
              chrome:extension="false"/>

    <RDF:Bag about="urn:mozilla:package:root">
      <RDF:li RDF:resource="urn:mozilla:package:danswizard"/>
    </RDF:Bag>

    <RDF:Description about="urn:mozilla:package:danswizard"
              chrome:displayName="Dans Wizard"
              chrome:author="Dan"
              chrome:name="Danswizard"
              chrome:extension="false"/>
    </RDF:RDF>

    It’s not elegant, and you would think that being a list you could just add the second RDF:Resource statement to the first bag, but doing this will simply not work.



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

       

    XML ARTICLES

    - 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...
    - Practical XML Data Design and Manipulation f...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek