Blog Entry

RSS Feed Browse

Google Opens Its Templating Technology

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.


Comments

Add Comment
  1. Conspirama - Google Opens Its Templ... on Jul. 24, 2008

    [...] 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. ... [...]

    0 Votes
  2. By an anonymous user on Jul. 24, 2008

    Open source projects live and die by documentation and examples. YUI has great documentation and makes the adaptation by web developers really easy. Lacking that, the uptake, as the article mentions, will be slow.

    0 Votes
  3. By Spitefulgod on Jul. 25, 2008

    Wow, now my pages can look just as crap as google, let us bow to our generous overlords!

    0 Votes
  4. By Laurence Gonsalves on Jul. 26, 2008

    The language and library references are both online and mostly complete. Once those are actually complete our plan is to write a bunch of examples. For now, some basic examples are already available in the talk slides, which are also online.

    We've also got a group set up and linked to from the project site, so if you have any questions or have suggestions for the documentation (like what you'd like to see us document first), please let us know.

    0 Votes
  5. By an anonymous user on Jul. 26, 2008

    How does it compare with XSL? Is there really any benefits?

    0 Votes
  6. By Laurence Gonsalves on Jul. 27, 2008

    Comparing GXP and XSL is a bit of an apples and oranges comparison. XSL transforms XML documents into other (also usually XML) documents. GXP, on the other hand, is a templating system for generating markup from dynamic values (ie: objects).

    XSL only operates on XML, so to build a dynamic website using XSL you'd need to use something else to convert your objects into XML before XSL can process them. For this you could either use a templating system (like GXP) or you could use some sort of XML serialization library.

    GXP doesn't need any sort of middle-man to convert your objects into some other format; GXP can take your objects as-is and convert them to markup. A more "apples to apples" comparison would be to compare GXP with other templating systems like JSP. We've got a page that discusses some of the differences between GXP and other templating systems here: http://tinyurl.com/whygxp

    0 Votes
  7. By Laurence Gonsalves on Jul. 27, 2008

    The language and library references are both online and mostly complete. Once those are actually complete our plan is to write a bunch of examples. For now, some basic examples are already available in the talk slides, which are also online.

    We've also got a group set up and linked to from the project site, so if you have any questions or have suggestions for the documentation (like what you'd like to see us document first), please let us know.

    0 Votes
  8. By an anonymous user on Jul. 30, 2008

    Google is the next Microsoft...

    0 Votes
Share Your Comments

If you are a member, to have your comment attributed to you. If you are not yet a member, Join OStatic and help the Open Source community by sharing your thoughts, answering user questions and providing reviews and alternatives for projects.

Trackback URL
Please use the following URL to add a trackback to this article.
http://ostatic.com/trackback/169539