首页 > Linux操作系统 > Linux操作系统 > XUL简介(转)


原创 Linux操作系统 作者:ilg 时间:2019-05-09 15:48:04 0 删除 编辑

  Why use XUL?


  翻译者:翟翔 最后翻译更新:2005年3月14日星期一

  The XML User Interface Language (XUL) is a markup language for creating rich dynamic user interfaces. It is a part of the Mozilla browser and related applications and is available as part of Gecko. It is designed to be portable and is available on all versions of Windows, Macintosh as well as Linux and other Unix flavours. With XUL and other Gecko components, you can create sophisticated applications without special tools.


  XUL was designed for creating the user interface of the Mozilla application including the web browser, mail client and page editor. XUL may be used to create these types of applications. However, it may also be used any place you would use currently use a web application, for instance, when you need to be able to retrieve resources from the network and require a richer user interface. Like HTML, in XUL you can create an interface using a markup language, use CSS style sheets to define appearance and use JavaScript for behavior. You also have access to programming interfaces for reading and writing to remote content over the network and for calling web services. Unlike HTML however, XUL provides a rich set of user interface widgets for creating menus, toolbars, tabbed panels, and hierarchical trees to give a few examples.


  This means you don't have to look for third party code or include a large block of JavaScript in your application just to handle a popup menu. XUL has all of these elements built-in. In addition, the elements are designed to look and feel just like those on the user's native platform, even supporting OS level themes in Windows XP and MacOS X. Or, if you prefer, you can use standard CSS to create your own look. The XUL widgets also support localization and have support for accessibility using OS level accessiblity interfaces.

  这意味着你不用搜索第3方代码或在你的应用程序中包含大段儿的JavaScript来处理一个弹出式菜单。XUL内置了所有的这些组件。而且,这些组件被设计成外观和感受就像用户本地平台上的组件一模一样,甚至支持Windows XP和MacOS X操作系统级的样式。或者如果你愿意,你可以使用标准的CSS来创建你自己的外观。XUL组件同样支持本地化,并且支持操作系统级的可访问界面。

  What is XUL?


  XUL is an XML language and you can use numerous existing standards including XSLT, XPath and DOM functions to manipulate a user interface, all supported directly by Gecko. In fact, XUL is powerful enough that the entire user interface in the Mozilla application is implemented in XUL.

  XUL是XML语言,并且你可以使用大量的现存的标准,包括XSLT, XPath和DOM功能来操作用户界面,全部都由Gecko直接支持。事实上,XUL足够强大以致Mozilla应用程序的全部的用户界面都可以在XUL下执行。

  In addition to the many built-in user interface widgets available in XUL, you may create additional custom widgets using a related language called the Extensible Bindings Language (XBL). This language may be used to create custom tags and implement custom functionality.


  XUL applications may be either opened directly from a remote Web site, or may be downloaded by the user and installed. Mozilla's XPInstall technology allows an application to be placed on a remote site and installed using only a couple of clicks of the mouse. No searching though the file system for an installer or stepping through a lengthy install process. The benefit of installing an application is lowered security restrictions so that applications may read and write files, and access user preferences and system information.


  XUL may also be used to create stand alone applications that embed the Gecko engine or may be used as part of the browser. A feature in XUL called an overlay allows a third party to create extensions to the browser itself, for example to add a custom toolbar, change menus, or add other features. This feature is popular in Mozilla Firefox -- there are almost 100 extensions available. Mozilla's upcoming mail client Thunderbird also has a number of extensions available. In fact, any XUL application can support extensions.

  XUL同样可以用来创建独立的应用程序,嵌入在Gecko引擎中或用作浏览器的一部分。XUL的一个特性是覆盖(overlay)允许第3方创建针对浏览器自身的扩展,比如增添一个自定义工具栏,改变菜单,或添加其他的特性。这个特性在Mozilla FireFox中很流行——大概有100个扩展。Mozilla的即将面世的邮件客户端Thunderbird(现在我已经爱上Thunderbird1.0,不再使用OE)同样拥有大量的扩展。事实上,任何一款XUL应用程序都可以支持扩展。

  Gecko also supports various Web Services technologies such as XML-RPC, SOAP and WSDL. These technologies have been used recently to create an application to browse for products on

  Gecko同样可以支持大多数的网页服务技术,诸如XML-RPC, SOAP和WSDL。这些技术已经被用来为amazon网站创建针对浏览器的应用程序。

  Standards and other Technologies Supported


  The following is a list of technologies supported by Gecko and can be used by XUL applications (not including XUL itself):


  • HTML 4.0 and XHTML

  • CSS2 and some of CSS3

  • DOM2 and some of DOM3

  • XML

  • MathML

  • RDF

  • XSLT

  • XPath

  • Simple XLinks

  • XPointer

  • XML Base

  • FIXPtr


  • SOAP (Simple Object Access Protocol)

  • WSDL (Web Services Description Language)

  • ECMAScript/Javascript

  • XBL (eXtensible Bindings Language)(可扩展的嵌入式语言)

  • GIF, JPG, PNG, BMP, ICO images

  • HTTP 1.1

  This list doesn't include all of the mail related features used by Mozilla Mail which you could also use in your own application to support POP3, IMAP and LDAP.

  这个清单没有包含所有被Mozilla Mail使用的相关联的邮件特性,你同样可以使用你自己的应用程序来支持POP3,IMAP和LDAP。

  XUL as an Application Platform


  XUL and Gecko make an excellent choice for building sophisticated Web applications. It provides a rich user interface toolkit, an HTML and CSS renderer with excellent standards-compliance and support for web services, all completely cross platform.


  Work is ongoing with the Gecko Runtime Environment (GRE), which aims to make Gecko a snap to drop into a standalone application, complete with your own executable, if you desire. The idea is to allow the right version of the GRE to be installed automatically with the application if necessary. If the GRE is already installed, there is no need to install it again, or even download it. For those that are interested, the GRE is about 5 to 10 MB, depending on your platform, which is quite small compared to other application platforms. It's also possible to have Gecko run directly from a network drive or CD.


  Since XUL may be used on Web sites, it can be used with server-side architectures such as PHP and JSP to build dynamic content. This allows Gecko to be both a two-tier or a three-tier application model depending on your needs. There are projects in development now which aim to integrate Java, Python and other languages into Gecko directly.

  XUL可以用在网站上,它也可以用于服务器端架构,诸如PHP和JSP来构建动态内容。这允许Gecko充当双重的或三重的应用程序模式,取决于你的需求。现在已经有开发项目打算把Java, Python和其他的语言直接整合到Gecko里。

  Where to Start?


  XulPlanet provides tutorials and references on XUL, XBL and other related technologies. There is also information from For complex examples, you can try any of the various Mozilla Firefox extensions, projects on or even the XUL used by the Mozilla applications themselves. Just open the files with a JAR extension in Mozilla'a chrome directory using a ZIP utility and take a look at the files.

  XuPlanet提供教程和XUL有关信息,XBL和其他相关联的技术。还有来自mozilla.org的信息。比如,你可以尝试任何一款Mozilla FireFox的扩展,mozdev.org上的项目或被Mozilla应用程序自身使用的XUL。在Mozilla chrome目录下打开以JAR后缀名的文件,看看这些文件。

  To start learning XUL, begin the XUL tutorial.


  Or, learn more about XUL and related technologies.


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量