Skip to main content

If you don't have an IBM ID and password, register here.

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. This profile includes the first name, last name, and display name you identified when you registered with developerWorks. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

XML in Firefox 1.5, Part 1: Overview of XML features

Discover new XML features for the fastest-growing Web browser

Uche Ogbuji, Principal Consultant, Fourthought Inc.
Photo of Uche Ogbuji
Uche Ogbuji is a consultant and co-founder of Fourthought Inc., a software vendor and consultancy specializing in XML solutions for enterprise knowledge management. Fourthought develops 4Suite, an open source platform for XML, RDF, and knowledge-management applications. Mr. Ogbuji is also a lead developer of the Versa RDF query language. He is a computer engineer and writer born in Nigeria, living and working in Boulder, Colorado, USA. You can find more about Mr. Ogbuji at his Weblog Copia or contact him at uche@ogbuji.net.

Summary:  The open source Firefox Web browser continues to grow in popularity. Users like the security and convenience features it offers. Developers like the Firefox attention to standards compliance, inherited from its Mozilla roots. The most recent version, Firefox 1.5, comes with many features for XML developers, including XML parsing, XHTML, CSS, XSLT, SVG, XML Events in JavaScript™, and XForms. Additional third-party extensions provide even more XML support. In this article, Uche Ogbuji provides an overview of XML features in Firefox 1.5.

View more content in this series

Date:  21 Mar 2006 (Published 20 Sep 2005)
Level:  Introductory

Comments:  

Firefox is a relatively new Web browser and currently the most popular browser built on the Mozilla platform. You've probably heard of it because of its phenomenal growth and its profile as an open source software success story. Perhaps it's even your Web browser of choice, as it is mine. IBM made news earlier this year by encouraging its employees to use Firefox and by standardizing Firefox support with its enterprise help desk. IBM has also been improving Firefox support throughout its product line, including Lotus® Domino®. Other enterprises, impressed by the confidence shown by such a prominent IT company, are moving their internal standards toward Firefox.

One of the advantages of Firefox is that it inherits many XML features from Mozilla. Many of these features have historically been offered partially or tentatively in Mozilla (and Firefox), but in the 1.5 release Firefox made a big leap in the number and quality of XML features. Firefox 1.5 is a good Web browser for XML developers and should help drive the adoption of client-side XML features that have been slow to spread on the Web. It's important to keep in mind that many current developments in Web technologies -- including developments in Firefox browser features -- are making the Web browser an increasingly complete platform for specialized applications development, rather than just a simple tool for browsing the Internet. XML generally plays a significant role in these technological developments, which some commentators refer to as Web 2.0.

In this series, you'll learn about the various XML features in Firefox 1.5. This first article gives you an overview of these features. See Resources for more information about how to grab a copy of Firefox for your own use and development.

Overview

From the days of the pioneering Web browser NCSA Mosaic, the role of a browser has been to retrieve the various files that make up a Web page and organize them for user display. The most common formats for such files have been HTML and various binary image formats. XML was originally intended to be SGML on the Web, and its advent has brought with it all sorts of new XML-based formats that Web browsers have had to properly parse and display. The most basic task for an XML-aware browser is for it to be able to prioritize which format is the most important, and Firefox is no slouch in this department.

XML

Mozilla (and thus Firefox) has been able to parse plain XML (including namespaces) in nonvalidating mode for years. By default, it simply displays a simplified view of the XML, telling the user:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

You can embed portable xml:stylesheet processing instructions in the XML to instruct Firefox to load a CSS stylesheet or XSLT transform (both are discussed in a moment) and automatically display the result to the user instead of the original XML. In this case, the browsers's "view source" feature displays the original XML. One drawback of Mozilla is that it parses large XML documents completely before passing data to the rendering engine, which means that such documents can be slow to load. Mozilla developers have discussed adding incremental XML loading support for several years, but as of 1.5 such capability is not in place. Firefox does not support DTD validation or any of the other validation technologies such as W3C XML Schema (WXS) or RELAX NG. It does support enough of XLink (simple links only) to allow you to express the same sorts of links in XML that you might in HTML. Firefox also supports XML Base, a specification that allows you to set the base URI for resolving relative URIs in XLinks. Links can lead to fragments of documents using the FIXPtr variation on W3C's XPointer or a subset of an older draft of the XPointer specification.

XHTML

Mozilla Firefox 1.0 supports XHTML 1.0 Strict, Transitional, and Frameset, as well as XHTML 1.1 which is based on modularization of XHTML 1.0 Strict. XHTML 2.0 is still in the working draft stage. Some developers wonder how well XHTML 2.0 will be adopted because it's such a significant change from HTML and XHTML 1.x. I recommend that Web developers targeting Firefox (such as for embedded applications) serve XHTML 1.1. Unfortunately, this may not yet be practical for developers targeting the general Web. I don't intend to discuss XHTML much more in this series, but I do have a full tutorial about XHTML 1.1 on the developerWorks site. (See Resources.)

My colleague, Kurt Cagle, shares his observations about XHTML support:

There are some subtle differences in the layout model of XHTML within Gecko compared to HTML, including the fact that CSS applied to the body only covers the region within the document margins -- to do a full page background, you have to assign the CSS to the <html> element itself. [Also], Firefox XHTML supports compound document subparts, making it useful to integrate HTML and SVG content, for example.

Cascading Stylesheets (CSS)

Cascading Stylesheets are the prevalent means of rendering XML in a Web browser. Of course, they're also heavily used for HTML style as well, and the technology has always received strong support in Firefox (as in most browsers). CSS 2.0 is a complete recommendation of the W3C, and Firefox 1.0 supports most of the spec. A working draft of CSS 2.1 offers a relatively minor set of revisions to 2.0. CSS 2.0 and 2.1 are collectively called CSS2. Firefox 1.5 improves the CSS2 support and also adds more support for CSS3, which is currently still in working draft stage at the W3C. CSS3 is seeing early adoption because it addresses many pressing needs of Web developers, including better support for XML constructs. Later in the series, I discuss CSS, but I also recommend my series of tutorials (available on developerWorks) about using CSS with XML (see Resources). These resources also include practical demonstration of some of the limitations of Firefox's CSS2 support, most of which is fixed in Firefox 1.5.

Scalable Vector Graphics (SVG)

SVG is the W3C specification providing an XML-based image format. SVG images are portable, resolution-independent, and surprisingly compact -- despite being represented in XML (the result of a few XML design compromises). The feature set includes nested transformations, clipping paths, alpha masks, raster filter effects, template objects, and (of course) extensibility. SVG also supports animation through a module of Synchronized Multimedia Integration Language (SMIL), zooming and panning views, a wide variety of graphic primitives, grouping, scripting, hyperlinks, structured metadata, and easy embedding in other XML documents. SVG works in other XML and Web-related technologies such as CSS and Document Object Model (DOM). Mozilla has had optional and sketchy SVG support for a long while now, but no one put in the effort to get it polished and built-in by default until Firefox 1.5 arrived with out-of-the-box, native SVG support (specifically a subset of SVG 1.1 Full). Some of the features missing in 1.5 are declarative SMIL animation (animation is only possible through scripting), filters, text paths, masks, patterns, and SVG defined fonts. Firefox transparently displays resources served with the MIME-type image/svg+xml as SVG, with no special plug-ins required; this includes SVG images embedded in object elements.

MathML

MathML is the W3C's XML vocabulary for representing mathematical information. It allows you to express mathematics either with conventions that focus on the abstract mathematical meaning (content markup) or with conventions focused on how it should be displayed (presentation markup). The specification is currently at version 2.0 and Firefox supports this version, either stand-alone or embedded within XHTML. Be warned that users may need to add some fonts to their systems to view MathML documents.

canvas

canvas is an element that serves as a scriptable, bitmap drawing surface. The uses are almost endless: games, flashy business presentation graphics, specialized forms controls, simulations, and complex data visualization -- just to name a few possibilities. You define the fixed size of the canvas in the element itself, and then typically you do the actual drawing from a script that uses the canvas API to create visual objects on the canvas. canvas was first developed by Apple for their Safari browser as a foundation for complex graphics facilities such as SVG support. Mozilla picked up the idea, and canvas is now a specification of the WhatWG consortium of browser vendors. Mozilla's canvas currently supports only two-dimensional graphics, but 3D might be on the horizon if OpenGL facilities are made available for the Mozilla platform.


Working the document model

Web browsers have long offered dynamic features so that developers could offer more than simple, static pages. With the trend toward complex Web applications, such features have become even more complex and many of them build on XML in some way. JavaScript (or ECMAScript in its international standard form) is a powerful, dynamic language that forms the basis of most dynamic features in Web browsers.

ECMAScript for XML (E4X)

E4X is a standard that adds native XML datatypes to the ECMAScript language and provides operators for common XML operations. To quote the E4X specification page:

E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects, and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names, and other mechanisms to facilitate XML processing.

E4X is probably used most often as a way to parse XML into ECMAScript objects that can be very easily manipulated. This does create some sticky issues because its direct use of XML syntax means it can cause a bit of confusion when embedded in other tag-based formats. In fact, in Firefox 1.5, E4X was disabled by default on HTML pages because it interfered with the traditional way of hiding scripts from noncompatible browsers. However, Web page authors can enable it within any script element by using an attribute of the form type="text/javascript; e4x=1".

XSLT

Mozilla has supported XSLT for nearly five years and in recent years, that support has been fairly reliable, including the ability to invoke XSLT transforms from ECMAScript. Firefox doesn't include any major changes to the workings of XSLT in Mozilla. It would be nice to at least have support for EXSLT extensions, but this is not on the roadmap -- although it has been a topic of discussion and might be a future possibility.

XForms

XForms is a specification of Web forms for XML data processing that can be used with a wide variety of platforms through various media. XForms looks to separate a form's purpose from its presentation; that is, what the form does from how it looks. An XML vocabulary can be used to develop form UIs for manipulating XML content. XForms serves as the forms module for XHTML 2.0, but is a stand-alone W3C recommendation. It's more complex than the familiar HTML forms elements, but it can be used to produce much more sophisticated and portable forms. There was some resistance to XForms support in Mozilla because of its complexity, but in August 2004, IBM and Novell offered resources, and the Mozilla Foundation launched a project to implement XForms in Mozilla. The fruit of this labor is available in Firefox as an extension. Firefox also adds support for XML Events, a W3C specification, related to XForms, for listening for events related to the manipulation of XML objects, and for handling such events. As an example, an XML event would be raised when a user changes the text in an XForms-based text entry field.

eXtensible Tag Framework (XTF)

XTF is a Mozilla-specific technology that allows extension authors to create new XML namespaces in Mozilla, using code that they write in ECMAScript or C++ (technically, they can write in any language with support for the Mozilla component system, XPCOM). In fact, XTF is what the Mozilla XForms Project uses to add support for elements in the XForms namespace. XTF promises to be a powerful way to add all sorts of XML technologies to Mozilla without having to wait for support in the core.

Web services

Firefox allows you to access XML Web services from ECMAScript. There are components for SOAP 1.1, WSDL 1.1, and XML-RPC. In this way, you can incorporate features that are available through messages from remote service providers.


Firefox: The complete XML-based browser workbench

For some people, the crown jewel of Mozilla's XML capabilities is XML User Interface Language (XUL), a markup language for describing cross-platform user interfaces. XUL is designed for the Mozilla platform but intended for more general use. The best way to think about XUL is to imagine all the various bits and pieces that appear in a Web browser: a main rendering area, menus, icons and buttons, a URL bar, title bars, status bars, sidebars, dialog boxes, and so forth. XUL allows you to create, arrange, and activate all these components. In fact, the full Mozilla Web browser was written as an XUL application. An XUL application is specified in XML where each component is defined. Firefox 1.5 brings some important enhancements to XUL, including dynamic overlays and translucent backgrounds, which increases your flexibility in combining and presenting XUL components. XUL works closely with another XML-based declaration language, Extensible Binding Language (XBL), which allows you to specify special behavior for components expressed in XUL. Mozilla also uses Resource Description Framework (RDF) to manage semi-structured data used in XUL. RDF is a metadata system with an XML serialization for the Web, a model for describing collections of formalized statements about a Web resource.


Summary

You can see how broad and deep Firefox's XML support is. In this article, you viewed a high-altitude map of these features. In forthcoming articles, you'll get more detail about much of this territory, with snippets of working code for Firefox. This is a particularly exciting time for XML developers since XML is driving the next generation of Web technology, and Firefox users stand poised to take advantage of these developments.


Acknowledgement

Thanks to Kurt Cagle, for providing assistance with this article.


Resources

Learn

Get products and technologies

  • Get Firefox, the Mozilla-based Web browser that offers standards compliance, performance, security, and solid XML features.

About the author

Photo of Uche Ogbuji

Uche Ogbuji is a consultant and co-founder of Fourthought Inc., a software vendor and consultancy specializing in XML solutions for enterprise knowledge management. Fourthought develops 4Suite, an open source platform for XML, RDF, and knowledge-management applications. Mr. Ogbuji is also a lead developer of the Versa RDF query language. He is a computer engineer and writer born in Nigeria, living and working in Boulder, Colorado, USA. You can find more about Mr. Ogbuji at his Weblog Copia or contact him at uche@ogbuji.net.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in

If you don't have an IBM ID and password, register here.


Forgot your IBM ID?


Forgot your password?
Change your password


By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. This profile includes the first name, last name, and display name you identified when you registered with developerWorks. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)


By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=XML, Web development
ArticleID=94157
ArticleTitle=XML in Firefox 1.5, Part 1: Overview of XML features
publish-date=03212006
author1-email=uche@ogbuji.net
author1-email-cc=dwxed@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).