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.
It is also important to note that the use of user-defined components does not increase the time of the system display window than the system display window, because the consumption of XML, DOM, definition style, and layout is constructed. Unrelated to whether a predefined component is used. 2.3 Implementation of XUL To implement XUL, you must: (1) Building a layout engine (2) of XUL CSS DOM JS to achieve additional layout primitives, such as Spring, Strut model, and Popups, these additional The layout primitive can be interoperable with the standard CSS defined layout primitive. (3) Implement a binary Cache to accelerate the overload speed of XML and JS. (4) Implement a component / label extension model, such as XBL, allowing the XML tag to be defined as components and multiplexes in other pages, windows, and dialogs. (5) Implementing the XML tag support for other components of the system, such as TREE, etc., these components are not implemented in HTML. (6) Provide the binding of the background data and the GUI XML file by using RDF in a certain data binding form (Mozilla is RDF). (7) In addition to the local language format, it is necessary to provide a complete set of SDK, support file I / O, network and other operations for JS. (8) Implementing the infrastructure support, providing command operation and command update support (9) to implement an efficient memory cache for CSS and XML to achieve lightweight prototype replication and sharing (you can use "Welcoming Copy" Semantics). 3. What is XAML Microsoft will launch a Longhorn platform in 2006, including a variety of technologies updates, including: (1) File storage system combined with the next generation of SQLServer technology Winfs (2) new expression subsystem "" Avalon "" Indigo ", etc. The statement of this language is released on the PDC (Professional Developers Conference), which has attracted extensive attention. XML-based Gui Languages has developed quickly, especially in the Mozilla platform, in the past few years, especially the Mozilla platform. It is considered to be the development direction of the interface declaration language. And the Microsoft's XAML, and the XUL of the Mozilla platform has a lot of similarities, so we need some understanding and comparison of XAML.
4.xaml Brief Reproduction Microsoft's XAML is a new member who enters XML-GUI competition, because Microsoft's strong publicity of its own product technology, still has caused numerous attention and comments. Since Microsoft's Longhorn will be released until 2006, XAML may change during this period. XAML uses Microsoft's new vector graphics (Vector-based Drawing Library Avalon) through XML syntax. For Mac programmers, Avalon and Apple's Quartz (PDF and OpenGL) are very similar, and for Linux programmers, this XML VECTORS will feel from KDE and GNOME desktop environment. It can therefore be said that XAML does not have any new or unique technologies. Compared with new things, the original XAML file can be browsed through the LONGHORN version of IE, this and XUL can be viewed by Mozilla browser browsing. XAML is used to create canvas (canvastes, an entity used to display images, text, and widgets), Widgets, such as a Button or Menu, and Shapes, such elements, these elements, etc. The initial appearance is defined by their attributes (just like XUL and SVG), or uses an XAML unique 'style' element (Element). Elements The behavior can be defined using any .NET compatible language (currently supporting C #, VisualBasic.net or JScript.net), there are two ways to bind behavior and interface elements, one is definition (code) of behavior (code) In addition to the CDATA paragraphs in the XAML file, the other is to access the Widget by a tree structure similar to the W3C. The following example is the content of an XAML file, which contains C # code, you can see that the code is in
In the label, and by
Enclosed, such a parser can ignore the code segment when parsing the XAML file.