Home arrow XML arrow 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
(Page 1 of 4 )

Now we have our main interface file, and I can imagine that you’re eager to see how it will look.  But before you can get even a glimpse of it (due to the use of entity references instead of text) there are several things you need to do.

First, you need to describe the interface file in a language that Mozilla can understand; it needs to be described in the language of the Resource Description Framework (RDF.)  Its very name gives us an idea of the mechanism for how it works; the XUL file is a resource, and the RDF file describes it. 

The idea behind this framework for description is to enable information that would normally be separate to have identifiable relationships defined about it. RDF enables you to write machine (and human) readable data about data – metadata in fact.

The motivation behind this is of course, the semantic web.  This is a term that you may have heard, and is a vision of the W3C of an intelligent web where information is autonomously shared.  For a general example, image being able to search not for every web page that contains a target word or phrase, but for every page that contains a particular word in a particular context.

Getting back to the subject from which we’ve strayed, let’s create the RDF file that Mozilla needs in order to understand our interface.  The implementation of RDF you are going to use is the RDF/XML strain. As such, your file will need to begin with the XML declaration:

<?xml version="1.0"?>

The RDF:RDF container is used as the top level container, and namespace attributes are used to define the child elements in use:

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

Next, the RDF:Bag element describes the overall package:

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

As you can see, the name of the resource is stated using the RDF list element (RDF:li.)

Finally, additional information about the package is defined using the RDF:Description element:

<RDF:Description about="urn:mozilla:package:interface"
          chrome:displayName="XUL Edit Lite"
          chrome:author="Dan Wellman"
          chrome:name="interface"
          chrome:version="1.0"/>

The description element uses the same URN (Uniform Resource Name) that you specify in the RDF:Bag element to tie the information to the interface.  Finally, the RDF:RDF element is closed:

</RDF:RDF>

Save this file as contents.rdf in the content folder.


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