Based on the XML interface resource tag language, allow users to use XML technology to write interface elements (such as dialogs, menus, toolbars, etc.) and related information to XML resource files, dynamically loaded when the program is running. This gives more powerful interface processing capabilities to the application. With XML-based interface markers, developers can get the following benefits: When the resource changes, there is no need to recompile and link applications to separate the resources and code, making the program's design and development more flexibility in runtime You can dynamically change the resource file, thereby changing the style and appearance of the application allows the user interface program to run the hierarchy, data, and the hierarchical division of the program logic can be seen from the platform, and the XML-based user interface markup language can be The development model of the user application brings near revolutionary change, especially after the MSDN website advertises its XAML (XML Application Markup Language) language, it has attracted everyone's extensive attention to this technology. Here is some introduction and comparison of the current most focused user interface markup language XUL (XML User Interface Language) and XAML, it is hoped that you can cause you to analyze and discuss this technology. 1. What is XUL XUL may be a history of history and the most widely known XML-Based Gui Language, which is created by the Mozilla Foundation to quickly develop the interface of the Mozilla project. Currently, the interface of Mozilla Suit is implemented by XUL. Including Mozilla Browser Suite, a lightweight browser Firebird, Mail Client Thunderbird, and Netscape Browser Suite. Safari also implements some XUL, and another project (luxor toolkit) uses XUL to define user interfaces for Java Swing, and other XUL implementations can refer to XUL Alliance. 2.XUL Brief Description 2.1 XUL Structure XUL is a tag language that defines the layout of user interface elements, while the appearance of the interface (color, font, etc.) can be defined by attributes and CSS and image. The behavior of the element is defined by script ECMAScript, or the compiled from C can be interactively interact with the element through AOM (DOM extension of W3C). The binding of the behavior and the XUL element is implemented by XBL technology, which is published by Mozilla and has been submitted to W3C. Therefore, the appearance and behavior can be bound to a specific element by CSS or DOM. At present, XUL does not support SVG, XFORMS, SMIL, and other UI-related W3C technology. Of course, there is no reason to not support it. In fact, there is already a project that has enabled Mozilla to support SVG (should be noted, in Xaml, Microsoft Used your own vector image language WVG and is not compatible with SVG, similarly, there is an animation language that is very similar to SMIL).
The TAGS of the XUL language consists of the following four elements: (1) layout elements (such as HBox, VBox, Grid, and Stack et al.) (2) Components Widgets (such as Menulist, MenuBar, Toolbar, and Button, etc.) (3) commands, acceleration keys (Such as Command and KeySet) (4) XUL template (binding background data for UI, using RDF) Process of processing XUL files in Mozilla, with the process of displaying an HTML page is very similar (although there is no surrounding window chrome), the first is The XML file is parsed, and the label in the XUL file is built into a DOM (Document Object Model) tree, during which the associated CSS will be used to define the appearance of the label, and after establishing a layout object, it will The result is displayed to the user, for example a dialog, or a form. The essence, the core of XUL is still relatively simple, and its purpose is to describe the dialog box and the GUI element on the form using XML language. Therefore, you want to truly use XUL technology, it is inevitably required support: CSS, DOM, RDF, XML, XBL, JS, and XPCOM. 2.2 XUL loading loaded XUL files can be roughly divided into five steps: (1) XML files are used to build a DOM tree (2) CSS is used to define the appearance of this DOM tree (3) XBL via CSS It is attached to define the implementation of the component (Widgets). Some components use C definitions, and some use XBL / JS definitions, and some are mixed. XBL is very important for the implementation of components (unless you have to design a custom component). (4) JS can process the event in the XUL file, and many services can be called by the XPCOM package. This is also the core of the Mozilla toolkit definition, including file I / O, network load, drag and drop, and more. (5) RDF provides the function of binding background data for user interface. It can be used as an information (perhaps in the database) and the glue layer of the user interface. Mozilla also provides a binary way for XML files and scripts, thereby avoiding unnecessary parsing of XUL files, and CSS style definition is extremely fast (that is, it is highly optimized), and JS is also Nice, the speed is also very fast, mainly used to bind the user interface and the background service (perhaps C implementation). Of course, there is also a problem with the engine using XML CSS, that is, the user hopes that the GUI form can be displayed immediately. In contrast, maybe the browser is loaded with a webpage to take 1 to 2 seconds. The user can endure. So in this point, applications that use this user interface technology require a sufficiently fast machine to operate to make up for the additional spending sales required to build user interfaces.