Book Image

Backbase 4 RIA Development

Book Image

Backbase 4 RIA Development

Overview of this book

Backbase is a very powerful and complex JavaScript library, with many user interface components to help make web development easier. It allows the development of Rich Internet Applications (RIA) that run within all major browsers but its powers and complexity mean that the choice of component can be overwhelming. Understanding when and how to use the right component might not always be straightforward. This book makes that easier. This is a practical book that teaches you how to use the Backbase Client Framework effectively, with a complete overview and many examples. A core developer of the framework puts the technologies used into a wider perspective of existing web standards and a seasoned software architect explains why XML-based UI definition produces better web applications. The transparent use of AJAX technologies, for example to submit forms, or to retrieve updates for data grids, can be taken for granted with the Backbase framework. Packed with examples, the book shows you how to get the most from the library of UI components, and then extend the library with its own custom language. With this book in hand, it is easy to enable AJAX within your web application. You will be able to use the Backbase framework effectively, from basic applications to complex, custom-defined UI components. This book contains a complete overview of all the UI libraries available within the Backbase framework and shows examples for each element described. The Backbase framework offers an innovative Tag Definition Language (TDL), which allows developers to create new UI components that can be used as XML elements, in the same way as using the built-in GUI library. Using TDL brings considerable development advantages, and this book explains how. Significant attention is also given to architectural aspects of designing a web-application, showing sample applications using a model-view-controller approach.
Table of Contents (16 chapters)
Backbase 4 RIA Development
About the Authors
About the Reviewers

XML and namespaces

If you know HTML, you also know XML, the Extensible Markup Language—just think of it as HTML where you can invent and specify your own tags.

To be more specific, XML is a general-purpose markup language, which means that you can describe and annotate the structure or formatting of text with it. HTML is a particular example of XML used to describe the structure and formatting of a web page.

Using XML, you can define a set of tags that together form a vocabulary for a specific subject. This is great if in all XML documents you would only need tags from one vocabulary, but probably you can imagine that this would be rather restrictive.

In this section, we give some background for the use of XML namespaces in the Backbase framework. As the W3C standard puts it, XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI references.

Why do we need XML namespaces?

When XML was invented, there was no such thing as a namespace concept. The steadily increasing volume of XML data that was exchanged between different groups of people and different companies revealed a series of problems. One was that it was difficult to properly combine parts of different XML documents into new documents. Basically, these are the causes:

  • An XML vocabularies collision problem. This means that two XML documents could have tags with the same name, while in each document this tag could have a different meaning or structure. For example, a <language> tag could have an attribute version if it is a programming language, or else an attribute region, to indicate where this particular form of natural language is spoken.

  • An intended content recognition problem. This means that if I see a tag in a document that has tags from more than one vocabulary, I need to know to which vocabulary it belongs. For example, if you see a <title> tag, is this the title of a book, the title in an HTML document, or the title of a person, such as "Mrs." or "professor"? Similarly, is a <border> the border of a country or a border of an element on a web page?

In order to solve these issues, the mechanism of namespaces was introduced into XML. If you are familiar with a programming language like Java, the namespace concept is similar to the package concept in that language. It enabled authors to determine, on markup, vocabularies for their content and facilitated governance.

Declaring XML namespaces

You can recognize an XML namespace when you see an attribute that starts with xmlns. The part of the attribute that follows xmlns: is called a prefix. It is that part of the namespace declaration that actually sets up a link between a convenience token and a namespace. The namespace declaration scope is limited to the element where it was done and to the element's sub-tree. The names of these attributes are reserved: you cannot use an xmlns attribute or prefix for another purpose.

Let's consider a sample XML document that uses namespaces:

<?xml version="1.0"?>
<book isbn:id="1847196705" id="1">
<title>Learning jQuery</title>
<author>Karl Swedberg</author>
<author>Jonathan Chaffer </author>
<isbn:datePublished>February 2009</isbn:datePublished>
<book isbn:id="1847191444" id="2">
<title>Joomla! Template Design</title>
<author>Tessa Blakeley Silver</author>
<isbn:datePublished>June 2007</isbn:datePublished>
<!-- More books -->

The catalog could serve as a description of books in a local library. The meaning and structure of the tags can be whatever the local library thinks is practical. In this document there is also the isbn namespace, which is used for tags that are relevant to the worldwide book register that the International Standard Book Number (ISBN) represents.

Use of namespaces with Backbase

The Backbase Client Runtime processes all the tags that are placed between script tags that have type="text/backbase+xml" as attribute. To the Backbase Client Runtime, the combination of the namespace and the tag name will determine what the engine will do to interpret the tag.

We call a set of tags that belong to a specific namespace a markup language. In the Backbase point of view, XHTML is just another markup language. It belongs to the namespace, which you must declare just like the specific Backbase namespaces.

We have already seen several namespaces in our examples. Below is a list of namespaces you can expect to be using with Backbase, together with their preferred prefixes:

xmlns = ""
xmlns:xi = ""
xmlns:xs = ""
xmlns:smil = ""
xmlns:b = ""
xmlns:c = ""
xmlns:d = ""
xmlns:e = ""
xmlns:bf = ""

Although it is legal to use different prefixes bound to the same namespace URI in different documents as well as within the same document, it is often convenient to stick to using similar ones.

For each markup language in your application, you must add a namespace declaration. For example, if you are using BTL UI widgets, you will need to add a BTL namespace declaration to your document.

The engine does recognize namespace declarations placed outside its processing space. This means that the best place to declare namespaces for all languages processed by the Client Runtime is as high as possible in the DOM tree, for example the <html> tag.


Each XML document, even if it will be included into another document, must contain appropriate namespace declarations.

Here is an example of namespace declarations that you could use with some of the Backbase markup languages:

<script xmlns=""
Given the correct widget prefixes,
the Client Runtime can now
process all XHTML, BTL, XEL, and XInclude elements.
XHTML is the default namespace, so we don't have to give a
prefix to the parent div tag.

Using namespaces in your application can be confusing at first and can be a source of problems for a Backbase beginner. A good piece of advice is to check your namespaces if you have an error that you do not understand. Soon, adding the right namespaces will become second nature.