Wednesday, July 20, 2005

WYSIWYG Programming for XSLT, XQuery, XPL, and More

Yesterday, I decided to write some code to generate an RSS feed from our project news page on the ObjectWeb Forge. It was a simple matter doing some screen scrapping and generating XML based on the collected data. I chose to go with XQuery as it was a perfect language for the task: the doc('') function makes a web page accessible as an XML document from which it is easy to extract data and generate RSS.

The final code is about 30 lines long, and while this is no rocket science, the code is full of little details. Getting those 30 lines right is an intense trial and error process. This is when the XQuery Sandbox came to my rescue and made my job much easier. Instead of having to constantly switch between an editor and a browser to see the result, I could type the XQuery code in a web page, and see the result as I was typing it, without even having to click on a "submit" button. Give it a try! And if you are interested in other languages, we also have an XSLT Sandbox, an XPath Sandbox, an XPL Sandbox, and an XUpdate Sandbox.

Those sandboxes use Ajax: the browser sends XML data to the server, which executes your program and sends back an XML response to the browser. Dealing with Ajax can be pretty complex, and you might think that creating those sandboxes pages must have involved a respectable amount of work. Think again: they are all written in XForms, and their code incredibly simple, while the heavy weight lifting is left to the XForms engine in PresentationServer.

No comments:

Post a Comment