Friday, 21 January 2011

Task 10: Download a free version of XML Spy. What does it do? How well does it do? Write a brief essay (2 to 4 pages) to answer these questions

TENTH TASK 

Download a free version of XML Spy. What does it do?  How well does it do? Write a brief essay (2 to 4 pages) to answer these questions.


Overview

XMLSpy is part of a suite of products from Altova that are aimed at helping you move around in, work with, edit, create and manage XML-based entities.  From XML to XSLT to WSDL and even SOAP-based entities, XMLSpy is built to give you all sorts of tools to work with your XML resources.  Working with XMLSpy is a very interesting prospect -


With XMLSpy, you have the tools to work in an environment specifically built to work with XML.  The entire suite of products runs the range of technologies working with XML.  From MapForce to StyleVision to SchemaAgent and even DatabaseSpy, the suite is built to give you gui-based tools to work through your information systems, build out the full range of XML and related documents and schemas and more.


XMLSpy 2011 remains the leading, industry-standard XML development tool thanks to its easy-to-use, intuitive interface and powerful utilities, which simplify and accelerate the XML development process. Below is a list of just some of the robust features available in XMLSpy 2011: which offers both students, and programmers the ablility to use almost everything from validation to well- formedness parsers and etc. because this important as to every code you write is has to be validated and well-formed.

  • XML design, editing, validation, and well-formedness checking
  • Schema-aware XSLT 1.0/2.0 editing, debugging, and profiling
  • Instant transformation of XML documents
  • Grahical XML Schema and DTD design, editing, and documentation
  • Modeling and management of schemas and their components across workgroups
  • XPath 1.0/2.0 Analyzer window and builder
  • Schema-aware XQuery editing, debugging, and profiling
  • SOAP client and debugger
  • Support for all major relational databases
  • Graphical WSDL editor
  • Java, C++, C# code generation based on XML Schema
  • Integration with Microsoft Visual Studio and Eclipse
  • XML-aware file and directory differencing/merging
  • Project management capabilities
  • WebDAV client interface support

Using the System

XML is a big undertaking.  There are a lot of different aspects to working with XML effectively.  This is precisely why XMLSpy can bring so much to the table in your own installations.  Part of the issue with XML is that you want to constantly have properly formed XML documents, from the data elements to the formatting and tags and so-on.  With XMLSpy, you get the help you need to stop worrying so much about the framework and more about what you're trying to accomplish. 

For example, XMLSpy will analyze your document and make sure, as you work with it, that you're presented with the elements, types, structure and other information you need.  

What XMLSpy does so well is to give you the information you need to work with your XML document effectively. Providing this level of visibility - from the enumeration (values) associated with a given element to the data type to the structure of the elements - this visibility will save you huge amounts of time as you work with your documents.  Why?  Because you won't be guessing at the next element, the structure, the design of your data. 

Moving around XMLSpy is at first overwhelming - there are many options and diffrent tools you can use to explore and work with your document.  From layout tools to analysis tools, to different ways to simply review and use your documents, there is much that you can do.  While it's a lot to digest at first, once you get used to moving around, the fact that the menu options and toolbars activate and deactivate depending on where you are in the application makes it easier to learn.

XMLSpy also includes debugging tools.  You can work with your SOAP-based systems, work with XQuery and more.  The software has done a good job of figuring out what types of things you'll be working with and doing with XML, then creating a visual tool to work with that data. 

 XMLSpy also integrates wtih Visual Studio and directly integrates with databases. 

There are so many ways to approach XML - everyone uses different standards, different combinations of stylesheets, schemas, etc.  XMLSpy does a fantastic job exposing your information using whatever tools and approaches you need.  You're not locked in to seeing it in text, you can use the grid view or any of the other tools and options for working with your data.  You'll be covered.   

Conclusion

I admit it.  I was cynical when I started working with XMLSpy.  I've always been a "use notepad..." kind of person, or jumping into Visual Studio and working directly with XML there and manually creating the supporting documents, structures and so-on.I'm a convert now, though, I have to tell you.  I'm amazed at how quickly you can see, understand and work with an unknown XML document once you've brought it into XMLSpy.  By giving you outstanding graphical tools to inspect the data, you can quickly see the element tree and what's happening, without any guess-work. 

I'm very impressed with the difference it brings just in providing multiple ways to show you information, let you work with it, validate it and so-on.  Clearly applications that touch and use XML benefit directly and immediately from the ability to test the structure, confirm the elements and generally have things working as they should. 

Task 9: What is the difference between a .doc file and a .docx file? Why is this difference relevant to XML?

Microsoft released a security update KB969604 for Office 2007 (around June 2009)
This update causes document variables within Word docx files to be scrambled.  This update might still be pushed out via Office 2007 updates. 



Docx is created by Word 2007 and is Microsoft latest proprietary document incarnation. If you want users of pre-2007 versions to read your documents, save as .doc instead of .docx. Users of pre-2007 versions of Office can download and install the Compatibility Pack to read your .docx file but you can't guarantee that they have done so.


What is the difference between docx files and doc files?

Office 2007 uses Office Open XML formats with .docx and .docm filename extensions.
- Docx is an Office Open XML word document.
- Docm is a macro enabled Office Open XML document.
This means the file structure behind the scenes is quite different from the binary file formats used prior to Office 2007 such as .doc, .dot, .xls, and .ppt.


This dissimilarity is applicable to XML as it illustrates its well-built position in the generation as is valued by business that modify their program to support XML language for its suppleness and straightforwardness which is beneficial to all. Furthermore files in the latest XML format are equipped to weight less rather than the old format which has proved a significant in the user moving larger documents.


Task 9: AJAX both a success and a failure?” Discuss and provide examples of success and failure.

The term AJAX, originally coined by Jesse James Garrett of Adaptive Path in his essay AJAX: A New Approach To Web Applications, is an acronym for "Asynchronous JavaScript And XML." That's a bit of a mouthful, but it's simply describing a technique that uses JavaScript to refresh a page's contents from a web server without having to reload the entire page. This is different from the traditional method of updating web pages, which requires the browser to refresh the entire page in order to display any changes to the content.

Similar techniques have been around in one form or another (often achieved with the help of some clever hacks) for quite a while. But the increasing availability of the XMLHttpRequest class in browsers, the coining of the catchy term AJAX, and the advent of a number of high-profile examples such as Google Maps, Gmail, Backpack, and Flickr, have allowed these kinds of highly interactive web applications to begin to gain traction in the development world.

As the term AJAX has become more widespread, its definition has expanded to refer more generally to browser-based applications that behave much more dynamically than old-school web apps. This new crop of AJAX web applications make more extensive use of interaction techniques like edit-in-place text, drag-and-drop, and CSS animations or transitions to effect changes within the user interface. This tutorial will explain those techniques, and show you how to develop AJAX web applications of your own.

AJAX Web Applications
AJAX can be a great solution for many web development projects -- it can empower web apps to step up and take over a lot of the ground that previously was occupied almost exclusively by desktop applications.All the same, it's important to keep in mind that AJAX is not a sort of magic fairy dust that you can sprinkle on your app to make it whizzy and cool. Like any other new development technique, AJAX isn't difficult to mis-use, and the only thing worse than a horrible, stodgy, old-school web app is a horrible, poorly executed AJAX web app.

When you apply it to the right parts of your web application, in the right ways, AJAX can enhance users' experience of your application significantly. AJAX can improve the interactivity and speed of your app, ultimately making that application easier, more fun, and more intuitive to use.

Often, AJAX applications are described as being "like a desktop application in the browser." This is a fairly accurate description -- AJAX web apps are significantly more responsive than traditional, old-fashioned web applications, and they can provide levels of interactivity similar to those of desktop applications. But an AJAX web app is still a remote application, and behaves differently from a desktop application that has access to local storage. Part of your job as an AJAX developer is to craft applications that feel responsive and easy to use despite the communication that must occur between the app and a distant server. Fortunately, the AJAX toolbox gives you a number of excellent techniques to accomplish exactly that.
Defining AJAX and its Benefits Plus Sucess and Failure
AJAX development is such an enormous leap forward for web development: instead of having to send everything to the server in a single, huge mass, then wait for the server to send back a new page for rendering, web developers can communicate with the server in smaller chunks, and selectively update specific areas of the page based on the server's responses to those requests. This is where the word asynchronous in the AJAX acronym originated.

It's probably easiest to understand the idea of an asynchronous system by considering its opposite -- a synchronous system. In a synchronous system, everything occurs in order. If a car race was a synchronous system,  The car that started first on the grid would be the first across the finish line, followed by the car that started second, and so on. There would be no overtaking, and if a car broke down, the traffic behind would be forced to stop and wait while the mechanics made their repairs. Traditional web apps use a synchronous system: you must wait for the server to send you the first page of a system before you can request the second page, as shown in Figure 1.1.


























 Figure 1.1. A traditional web app is a synchronous system
 
As an example An asynchronous car race would be a lot more exciting. The car in pole position could be overtaken on the first corner, and the car that starts from the back of the grid could weave its way through the field and cross the finish line in third place. The HTTP requests from the browser in an AJAX application work in exactly this way. It's this ability to make lots of small requests to the server on a needs-basis that makes AJAX development so cool. Figure 1.2 shows an AJAX application making asynchronous requests to a web server.


























 Figure 1.2. An AJAX web app is an asynchronous system
 
The end result is an application that feels much more responsive, as users spend significantly less time waiting for requests to process, and don't have to wait for an entire new web page to come across the wire, and be rendered by their browsers, before they can view the results.

Because Ajax applications are more difficult to build than classic web applications, they must contain certain Success that make them worth it. Applications built with Ajax have much more responsive interfaces. Users experience changes in a way that feels instantaneous. In traditional web applications, multiple connection threads are used to speed up deliveries between client and server. But this only affects content. All scripts and format information are communicated through a single connection thread, which negatively impacts performance. Ajax uses multiple connections to load basic scripts and CSS files; the rest is requested as content.

The primary failure of AJAX include increased development time and costs, even though using Ajax can be more difficult to use when building applications rather than traditional client server web applications. However, this is tempered by the fact that most of the technologies that make up Ajax are already known. Ajax’s asynchronous nature can also cause conflict because it interferes with traditional ways of navigating the web and book marking sites.

References:http://www.helium.com/items/580436-advantages-and-disadvantages-of-ajax[Accessed 20/01/2011]

Task 9: What is wrong with XML? Illustrate your responses with examples

 XML (Extensible Markup Language) is a general-purpose specification for creating custom markup languages. The term extensible is used to indicate that a markup-language designer has significant freedom in the choice of markup elements. XML's goals emphasize representing documents with simplicity, generality, and usability over the Internet. XML has been used as the basis for a large number (at least hundreds) of custom-designed languages. Some of these, for example RSS, Atom, and XHTML, have become widely used on the Internet. XML dialects (often packaged in archive files) are becoming the default file format for office-productivity software packages, including Microsoft Office, OpenOffice.org, AbiWord, and Apple's iWork. Lets discuss advantages and disadvantages of XML.


During my Research I stumbled on a article that (Scientific American) clearly states what XML developers mean when they talk about the ability to use different types of document types. A doctor can e-mail an HTML document featuring a patient's medical records, but that does not mean much to the nurse receiving them who has to enter them into a database. The database would read the document, as the article says, as "<H1>blah blah blah<H1>", for example. With XML, the information can be organized into recognizable and totally subjective fields that can be more easily read by a database.

Also, when you submit a query to an online bookstore, you are not waiting for the price information. You are simply waiting for the stylistic presentation of some text, which could happen to be price information. This is how HTML does it; the flexibility of XML is supposed to deliver and understand (by way of organization) the actual material (i.e., the price). Furthermore, a surfer would then be able to search for prices. Since HTML does not have any delimiter for prices (while XML does, or rather, can), searches just return the word "price", which could be used in many other connotations, or irrelevant numbers.

When the article refers to the "World Wide Wait", it speaks of the amount of time that it takes for your query to get to the server and then back to you. This time is spent mainly on displaying the information, and not the information itself, and the article calls it a waste of time, which I agree with. After all, the Internet's first priority when it was designed was to transmit information, not present it. (Of course, a visually pleasing format is nice and adds a lot of the fun to web design; XML does not eliminate this capability.) XML would be able to implement another program that could compute the information specific to that document and then return it to you on the spot. There would be no need to involve the server, hence removing the "wait". 

 
He discusses how XML can be seriously verbose, because of the specificity needed. While XML speeds up the transmitting of actual information, it also requires a lot of mark-up to be transmitted as well, and often the mark-up can outweigh the content. He also describes how XML is platform-neutral. This seems to be a "not a bug, but a feature" situation. This neutrality is what allows XML to be so flexible, to allow so many different types of information to be used by so many different types of media. But no one browser or application can understand 100% of its information. 

In my view, I feel that XML's main disadvantage is that, like almost any new, supposedly world-changing idea, there is a lot of hype involved. Most personal pages talk about this concept. It is not going to save the world, and in a narrower sense, nor will it solve all Internet data-related problems. It seems to me that the W3C's conversion from HTML to XHTML is a little quick; the average user is probably still adapting to HTML 4.0, and the game's rules are about to change completely. Of course, XHTML is designed to ease XML into widespread use of the Internet, but I don't know anyone who actually really knows how to use it yet. Also, it seems to me that the browsers have more say about what will be widespread and mainstream the W3C does; if the monolithic browsers (by which I mean, surprisingly, Netscape and IE) can't display it, what is the sense in using it? 


Everybody should take this new XML thing one step at a time. It seems to actually be quite simple to use, but that realization was only come to after a whole lot of digging. The W3C must remember that a large percentage of "web designers" (using the broadest sense of that description - those who design web pages) are not computer experts who have been waiting for XML's breakthrough for a long time. They are people who understand HTML and are now faced with a new language. 


However, XML has a lot of potential, and while I don't agree with a lot of the XML experts who say it is nearly as easy to use as HTML, it is by no means impossible for a casual web designer to learn. And the added difficulty is in fact more than compensated by the added power. I think the experts talk more about its ease of use in relation to the extremely complicated SGML, rather than in relation to HTML. And I totally agree that XML will allow Internet-transmitted documents to serve more functional purposes; having a web page that does not necessarily have to interact with a server but can interact with a database system is no mean feat. So once people get over the difficulty of learning XML, it appears that the ease pops up later, as they apply the language they have come to understand. 

Below are the XML Disadvantages in Views 

·         Enforcement of typing is not strong enough

·         Too flexible

·         Disagreement in the meaning of tags 

·         Comlicated XMl files with many constraints are hard to construct manually
·         Verbose

      XML syntax is redundant or large relative to binary representations of similar data.

The redundancy may affect application efficiency through higher storage, transmission and processing costs. 
      
      XML syntax is verbose relative to other alternative 'text-based' data transmission formats.

No intrinsic data type support: XML provides no specific notion of "integer", "string", "boolean", "date", and so on.
       
       Reference: http://www.theukwebdesigncompany.com/articles/xml-advantages-disadvantages.php[Accessed 20/01/2011]

Task 9: What are the most important security issues associated with XML? Discuss with examples.

 XML Security Issues

Security has always been vitally important in the business world to ensure the integrity of content and transactions, to maintain privacy and confidentiality, and to make sure information is used appropriately. However, in today's web-based business environment, the means for providing that security have changed. 

Using physical security no longer works as well as it did in the past when all the computing resources were locked in a central computing room with all jobs submitted locally. Efforts to create a single pervasive security infrastructure do not scale effectively to the Internet, due to the heterogeneous nature of hardware and software systems and to conflicting administrative, application and security requirements. There is too much to administer, too many applications, too many variations, and too rapid a pace of technology change to design a single infrastructure to meet all requirements effectively. Extensible standards are required that can adapt to changing requirements, that can incorporate new technologies while continuing to work with legacy technologies, and that can be deployed modularly as needed without requiring use of unnecessary portions.

These standards should work well together, not replicate functionality, and should fit with new technologies to enable open distributed systems, application integration and content management. 


An essential requirement of new security standards is that they work naturally with content created using eXtensible Markup Language (XML). XML is being adopted widely for a growing variety of applications and types of content. It is also forming the basis for distributed system protocols to integrate applications across the Internet, such as Web Services protocols. XML languages are text based and designed to be extended and combined. It should be natural to provide integrity, confidentiality and other security benefits to entire XML documents or portions of these documents in a way that does not prevent further processing by standard XML tools [ XMLRef ]. 


XML Security therefore must be integrated with XML in such a way as to maintain the advantages and capabilities of XML while adding necessary security capabilities. This is especially important in XML-based protocols, such as XML Protocol (XMLProt, Simple Object Access Protocol, SOAP), that are explicitly designed to allow intermediary processing and modification of messages.


Older security technologies provide a set of core security algorithms and technologies that can be used in XML Security, but the actual formats used to implement security requirements are inappropriate for most XML Security applications. One reason is that these standards use binary formats that require specialized software for interpretation and use, even for extracting portions of the security information. A second reason is that these standards are not designed for use with XML and do not support common XML technical approaches for managing content, such as specifying content with uniform resource identifier strings (URIs) or using other XML standard definitions for locating portions of XML content (like XPath [ XPath ]). 
 
In addition, some existing security technologies assume that security-specific software will be integrated with applications to enable security. In practice, this is not always the case due to the details of custom integration. XML Security addresses these issues by defining a common framework and processing rules that can be shared across applications using common tools, avoiding the need for extensive customization of applications to add security. XML Security reuses the concepts, algorithms and core technologies of legacy security systems while introducing changes necessary to support extensible integration with XML. This allows interoperability with a wide range of existing infrastructures and across deployments. 

 XML Security reduces barriers to adoption by defining the minimum modular mechanisms to obtain powerful results. By employing existing technologies and enabling use of XML paradigms and tools, XML Security minimizes the need to modify applications to meet security requirements. 

XML Encryption 

In the World Wide Web security is taken care of by secure socket layer (SSL) and Transport Level Security (TLS). This security software's makes sure that end to end applications are safe and secure, for example email communications. But these can cater to only the end to end segment. XML Encryption takes care of the gaps in the areas where the secure socket layer or Transport level security cannot fulfill. XML security is capable of providing end to end security and selective security. 

The XML syntax 

How XML digital signatures created are and what do they cater to? The applications of XML signatures can be extended to digitally encrypted documents and can be applied to any varied digital content including XML documents. The XML schema usually decided the XML signature application that will be used. The XML signature application can be enveloped within the document; it can be applied to documents from more than one resource.

The most important job of an XML signature application is to specify key for the encrypted documents. It is not the applications job to reference how the keys are associated with different persons to whom the communication is digitally encrypted or carry information what the data contains. Its job is to just provide the key for accessibility.

The specifications provided in a XML security application cannot take care of all security concerns and while the specifications cannot address them, it becomes essential to use additional keys, algorithms and rendering needs. XML uses the capital letters to carry out instructions usually in the schema. The schema is not concerned with grammar and its functionality is more to bring out the desired results by carrying out the essential commands.


Examples - An overview of Signatures 

XML signatures may be applied to digital content or data objects arbitrarily. Digital data objects are disintegrated and then placed with a cryptographic signature in the document. The Signature Element represents the digital data by using a structural format for representing the said data.

The validation process involves two steps. One is validation of the signature and the other is the validation of every single reference in the document. The algorithms that calculate the value of each signature is included in the signature itself. The key info usually has the info required to validate the document.The processing contains of three steps, core generation, core validation and core signature syntax. 

Core generation is further divided into two levels, reference generation and signature generation. In reference generation for every data object that has been signed, transforms are applied according the data object determined by the application. The value of the signature is calculated for the data object and then the signature element is constructed which will include the objects and the signed information. 

In Signature generation the process that is followed is using the signature method, canonicaliztion method and references, a signed info element is created. Using the algorithms in the signature info the value of the signed object is calculated and then the signature element is constructed which will include the objects and the signature, key info and the signature value. 

Core validation is further divided into two steps. These are the signature validation and reference validation. Some times in an application there may be some valid signatures but the application fails to validate these signatures. It may be caused due to the failure in implementation of a few parts in the specification or unwillingness to identify specific algorithms or even universal resource identifiers.

In the reference validation process the signed information element is canonicalized using the canonicalization method in the signed info. Then the data object is obtained and digested. The resulting data is digested or disintegrated using the digest method obtained from the reference specification and then the digest value is generated and compared to the digest value in the signed information reference. If there is any mismatch or inequality in the values the validation will fail and will be unsuccessful.

In the signature validation process the keying information is obtained either from an external source or in the key info and the canonical form of the signature info is obtained using the canonicalization method and the obtained result is used to validate the signature value and the signature info element. Core signature syntax provides information on the features the core signature. These features are important and a must for the function of the program or its implementation. This research study has proved that XML Security has Several standards are which are establishing a frameworkfor integrating security intodomain-specific XML-based applications which is crucial as to the important of cyber attacks.


  
References: http://home.comcast.net/~fjhirsch/xml/xmlsec/starting-xml-security.html[Accessed 20/01/2011]


Task 9: The semantic web is a failure.” Discuss, illustrating your answer with examples.

The Semantic Web is a great vision that began almost ten years ago, but at this point, the failures outnumber the successes by a very large margin. In order to move closer to realizing the great theoretical vision of its founder, Tim Berners-Lee, it is important to understand the common pitfalls of semantic undertakings. Let's examine the top 10 failures of Semantic Web projects and companies one by one.

The Semantic Web world is like a lumbering, giant group of smart people stumbling around without too much direction or vision, while all around them, smart and savvy entrepreneurs are creating amazing social, content, and mobile projects and companies at a comparatively break-neck speed and a fraction of the cost. In the last few years the Web has seen a revolution where small and cheap projects spring up, rapidly succeed or fail (and if fail, try again, succeed or fail, if fail, try again, and repeat this loop until succeed) and move forward, while Semantic Web projects are bulky, complex in nature, and require lots of time, money, and brain power before they can be even brought to market. They resemble projects of the late 90s where it took millions of dollars to realize whether a company would succeed or fail, while Web 2.0 companies can still participate in the "fail fast" startup approach where it takes 3-6 months and a few thousand dollars to realize whether the project will be successful or should be shut down.

The Web has shown that, while project organizers (large company projects or new startups) have to follow their vision, they also need to pay very close attention to the feedback of their users in order to get a sense of the true user experience of the product. The "rapid feedback loop" approach has garnered much attention and is prevalent in theories of Eric Reis and Steve Blank; and has been widely accepted throughout the business world. 

Unfortunately for Semantic Web, its projects are complicated and not easy to create. This increases the amount of time that has to pass before the initial customer feedback is even possible, also slowing down ensuing feedback loop iterations, ultimately putting Semantic Web applications at a user-experience and agility disadvantage when compared to their Web 2.0 counterparts, because usability inadvertently takes a back seat to the number of other complex problems that have to be solved before clients even see the application.


Remember how difficult it was to get a good Java programmer to work for your company or project in the late 1990s? We should be lucky I guess now the 21st Century has evolved with innovative technology incorporated with the Web. You almost had to give away your first born(just an expression), a signing bonus, and be forever sentenced to deal with prima donnas who did not have to play nice, and jumped jobs for larger salaries within months. That was the result of not enough supply of talent to go around for a very large demand of it. Right now a very similar situation is occurring in the Semantic Web world. Hiring a good NLP engineer (computational linguist) will cost you an arm and a leg and so will hiring a good taxonomist, ontologist, or a programmer who can work with Semantic Web frameworks and build the application. Not only that, but they know they are difficult to replace, so you are at their mercy if they decide they want to misbehave.

Not only are Semantic Web professionals more expensive, harder to find, and have more flexibility to misbehave, they can just kill a project simply by leaving because the work they do is often too complex for someone to just come in and pick right up where the original people left off. If the original people leave, the business owner gets stuck with a heap of unreadable code or a bulky ontology that now no one can understand, and lots of wasted time and money. Semantic Web technology is also harder to integrate and sell for the same reason -- it adds extra risk to the buyer since if the founders or creators leave, they get stuck with the best scenario of having to hire more expensive resources who will have a 3-6 months ramp up time if they succeed, and much more if they don't and other people will have to be hired. The world will have moved on by then.

Even the great Sir Tim Berners-Lee famously proclaimed that Web 3.0 is meant to live on top of Web 2.0 and not replace it. What is quickly becoming reality is that the incremental benefit of Web 3.0 over the traditional web is seldom enough to justify adding cost, risk, and time horizons to projects. It is becoming reasonably good practice to prove the business model success without even touching the Semantic Web, and if the business model works, to build out the Web3.0 components over time. Starting at Web3.0 without considering the lessons learned from simpler models is often a key to failure; just too lofty, too fast.

Reference:  http://gondwanaland.com/mlog/2005/03/18/semweb-ai-java-the-ontological-parallels/[Accessed 20/11/2011]

Task 9: What is XUL and how is it used? Give examples.

What is XUL exactly ?


That is the right question to ask well, XUL stands for the XML User Interface Language. Since it is XML, it is a declarative language. It provides a rich set of UI widgets that can accelerate the development process. It is a cross-platform language, so you can build your XUL application on Linux, and then run it on Windows. XUL makes heavy use of Web technologies such as JavaScript and CSS. You can even mix HTML directly into a XUL application. 



XUL is synonymous with Netscape and the Mozilla Foundation. From the early days of the Netscape browser, it was meant to be a cross-platform browser. From what I have researched the two browsers have a history of partnership. This required a UI framework that abstracted away OS-specific layout and control widgets. It required a way to allow communication between these abstracted elements and native processes for networking, file I/O, and so on. All of these elements were needed to build applications that weren't just cross-platform, but were designed for working with HTML and Web elements. This framework, known as XPFE (cross-platform front end) was used to build Netscape Communicator as well as the other products in its suite, such as its e-mail and chat clients.


You might be familiar with the rise and fall of Netscape, the company. Its IPO in 1995 marked the beginning of what is now looked back on as the dot com boom. By 1998 the company was not doing well financially, but made some important technological achievements. 

At the heart of this was the Mozilla project. This started with the code for Netscape Communicator 4.0 being released publicly under an open source license. That code-base proved to be too difficult to develop and maintain, but fortunately something better was in the works. Netscape not only made the existing Communicator code open source, but also the code for their next generation layout engine. That layout engine would become Gecko. One of its key features was support for a declarative, XML-based UI language known as XUL.




XUL is a proprietary UI language built for the Gecko engine. It has a wide appeal outside of the developers of Gecko-based Web browsers. That is because it is built on standard technologies, such as XML, JavaScript and CSS.


XUL is an XML language, which gives it a simple syntax and makes it easy to read (and parse)! XUL has a lot of similarities to HTML, so it looks familiar to Web developers. It even allows for XHTML elements to be mixed in with XUL widgets. In many ways, XUL has proven that XML is ideal for creating UI languages, as seen by the rise of similar languages such as MXML (the UI language in the Adobe Flex framework) from Adobe, and XAML (the UI language in .NET 3.0 and the Windows Presentation Foundation) from Microsoft.

Of course, declarative programming does have inherent limits Inevitably some imperative programming is needed. Rather than invent a new language or create some XML-based syntax for this, XUL supports JavaScript. JavaScript as a programming language often gets a bad reputation. It is known as a language that is easy for non-programmers to hack around in and as full of browser-specific extensions and quirks. However, JavaScript is a powerful language that is the backbone of Web application development. After all, JavaScript is the "J" in Ajax. It is a functional programming language, but can be easily used in a procedural or even object-oriented style. XUL brings JavaScript to the forefront as a desktop programming language.

XUL also relies heavily on the DOM implementation in JavaScript—after all, XUL is based on XML.The other pillar of Web development found in XUL is CSS. CSS has become the de facto way to add styling to any Web page. Its cascading nature, allowing styling to be applied to objects and their children while at the same time allowing children to override as many or as few styles as needed, provides tremendous power and flexibility. XUL brings this power and flexibility to desktop applications.

One other thing that JavaScript and CSS have in common is a reputation for having varying behavior from one browser to another. Browser sniffing is common in JavaScript, allowing programmers to code the same function in multiple implementations based on what kind and version of a browser the user is using. It's also found in CSS through the use of conditional styles. If you have done much Web development, then you have probably suffered these browser quirks. If this is the case, then you are going to really enjoy programming in XUL. You have only one browser to worry about in XUL. It's like programming a Web application in a world where everyone uses Firefox.

What kinds of user-interfaces can be made with XUL?

XUL provides the ability to create most elements found in modern graphical interfaces. Some elements that can be created are:
  • Input controls such as textboxes and checkboxes
  • Toolbars with buttons or other content
  • Menus on a menu bar or pop up menus
  • Tabbed dialogs
  • Trees for hierarchical or tabular information
  • Keyboard shortcuts

What Does XUL Code Look Like?

Code Listing 1.0 shows a simple XUL document describing a button interface for a simple XUL interface, the XUL file is an XML document and uses the XUL namespace, and you apply a stylesheet in the second line of the listing. The <window> element is always the root element of a XUL document. This example uses the <toolbox>, <button>, and <toolbar> XUL tags to describe a simple user interface. Code Listing 1.0 also has an event handler associated with it, as defined by the JavaScript <script> tag. This example will create a toolbar, with a button on it called “Sort Customers.” When the button is invoked, from either a key press or a mouse click, the message “You have clicked the Sort Customers button.” is displayed within a JavaScript alert box. Figure 1.1 shows the resulting interface after it has been parsed in the Netscape 6.x browser.

Code 1.0

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
<window id="main-window"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="dialog">
<script language="JavaScript">
function alertUser()
{
alert("You have clicked the\n\nSort Customers\n\nbutton.");
}
</script>
<toolbox flex="1">
<toolbar>
<button class="dialog" label="Sort Customers"
oncommand="alertUser();"/>
</toolbar>
</toolbox>
</window>


Figure 1.1










Reference: http://www.xul.fr/en-xml-xul.html [Accessed 19/01/2011]