Written by Mike Gunderloy - Jul. 24, 2008
Google is on a roll. Hot on the heels of releasing its internal Protocol Buffers data interchange format, it has open-sourced Google XML Pages (GXP). Though the project page reports this as version 0.2 beta, don't be fooled: according to a presentation about the technology, this is the templating language behind AdWords, Blogger, Google Reader, Google Analytics, and other properties.
As it currently exists, the GXP technology is firmly tied to Java, although a C++ code generator is in the works (and the existing code is included in the open source download). Now, if you're building web sites with Java backing, especially within the enterprise, the odds are pretty good that you're currently using JSP. Given the number of tools and frameworks that support JSP, why should you consider switching?
The first obvious reason is that this is clearly proven technology: you have to assume that if Google has put this code into major production, it works. But beyond that, GXP implements a number of useful and interesting features. My favorite is automatic escaping and quoting of content: using GXP automatically protects you against a huge range of cross-site scripting attacks. Another nice feature is validation (according to document type) of the content you include. For example, in an HTML document, GXP's compiler will flag things like unknown and misused elements and attributes.
Other key differentiators of GXP include built-in space collapsing, well-designed modularization, and built-in internationalization support.
Despite the attractiveness of its design, though, tackling GXP at this point is definitely a task for early adopters. That's because the documentation varies from "sketchy" to "nonexistent." The authors have promised to remedy this, but for now, reading the source code is your best bet. A good place to start is with the contents of the java/test/com/google/gxp folder - the unit tests will give you a strong sense of what markup you can pass to GXP, and what the results will be.