XML
  Home arrow XML arrow Page 4 - An Introduction to XUL Part 3
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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 3
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 7
    2005-06-06

    Table of Contents:
  • An Introduction to XUL Part 3
  • Flex and Grids
  • Groupbox, Stack and Deck
  • Content Elements

  • 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

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    An Introduction to XUL Part 3 - Content Elements
    (Page 4 of 4 )

    All I’ve talked about so far are elements; interface elements and layout elements.  What I haven’t mentioned yet are content elements.  We’ve seen buttons, labels, controls etc, but nothing in which to actually store content.  What that content actually is depends on what the application does, for a browser, such as Mozilla, the main content is HTML pages.  As XUL came around in order for Mozilla to actually be constructed, HTML pages are easily displayed using an iframe element.  To test this out fully, you’ll need a web page to display.  You could create one of your own, or to save yourself some time you could work with something that’s already out there.

    What I did was to go to the Google homepage (because it has a relatively simple homepage but features many links and has some functionality) in a browser, and save the page as google.htm to my XUL directory.  Do whatever you want, but get an HTML file that at least has links to other pages on it.  Now, create a basic window (I mean add the opening and closing window element to a blank text file with the necessary namespace) with nothing in it except the following line of code:

    <iframe src="google.htm" flex="1"/>     

    Note that the attribute must be included, or the page will not open within the iframe.  Now, save it as iframe.xul or similar and then execute it with the command line.  Your window should appear with the Google homepage loaded in it.  The links should work and you can even do actual searches with it.  You’ve just created a browser, with just a couple of lines of code!  If your window is smaller than the size of the page you’ve selected for this example, Mozilla will even include working scrollbars for you, with no additional code.  You’re not restricted to displaying just web pages either, change the src attribute of the iframe to one of the XUL files you’ve already created and watch in awe as that is loaded just as easily.  It will even render simple text files, which you can prove by changing the src to a file ending in .txt.  The files that you’re opening should be located in the same directory as the iframe.xul file, or should include the full path to them if they’re not.

    I feel it appropriate to mention at this point that true to its XML roots, XUL is also able to work with and process HTML tags and render them within its windows accordingly.  In order to use the tags that it supports you need to make sure that the XHTML namespace is imported.  This requires the addition of the namespace to the opening window tag, and an HTML prefix preceding each HTML element you wish to use.  Create the following file for confirmation of this:

    <?xml version="1.0"?>
    <window
      id="html"
      title="Render HTML"
      width="500"
      height="300"
      screenX="50"
      screenY="100"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/
      there.is.only.xul"
      xmlns:html="http://www.w3.org/1999/xhtml"> 

    <html:div>
      This is HTML!
    </html:div>
    <html:ol>
      <html:li>This is an html list item!</html:li>
      <html:li>So is this!</html:li>
    </html:ol>

    </window>

    So you see, there are several very basic ways to include content within your XUL files.  The next article introduces RDF, and explains how more complex elements can be access via a chrome URL from within Mozilla to give added functionality and power to your XUL applications.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Nice to build the interface, but till now i dont know, how to- connect the file...
       · Hi,Glad you liked the article, I'm working an an article that discusses actually...
     

       

    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

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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