Jakarta Commons - Digester component

The Digester component of the Jakarta Commons project is an extremely useful and well-designed package that allows you to parse XML files at a higher level of abstraction in Java. This allows developers to concentrate on processing XML rather than get unnecessarily involved in parsing functions. With Digester, you can use simple matching patterns and write corresponding callback functions which are called whenever a match is found. For example, consider the XML snippet below.

<book>
  <title>The Hobbit</title>
  <author>J. R. R. Tolkien</author>
</book>

In Digester, you can write this (in Java):

Digester digester = new Digester();

digester.addObjectCreate("book", "Book");
digester.addCallMethod("book/title","setTitle",0);
digester.addCallMethod("book/authors","setAuthor", 0);

digester.parse("books.xml");

When Digester parses the XML file (assumed to be “books.xml”), it will create a Book object when it encounters the tag, and it will call the setTitle() and setAuthor() methods with the arguments “The Hobbit” and “J. R. R. Tolkien” respectively upon encountering the <title> and <author> tags. Isn’t this very intuitive? I think it’s a very clean abstraction layer on top of XML parsing that allows developers to get on with “real” development work. Once again the Jakarta Project amazes me with what it can do.

simkim - embeddable scripting language

I came across a project called simkin today that is really interesting. For a demonstration, go here. Reminds you of XUL, doesn’t it? Only it uses XML files to allow an easy way to customise your application. XML isn’t the only way that’s available, as the script can be stored in something called a TreeNode file or in a database. What’s more, it can be used in MIDP (see here), and it uses kXML, a lightweight XML parser that I’m also using for my current project.

Code block and music

Well I had code block today, believe it or not. It’s that state of mind where you can’t make much (or any) progress in your development - a highly frustrating exercise.

To sooth my troubled mind, I got on a bus (I wasn’t sure if it’d take me to where I wanted to go, but I just hopped on) and went alone to buy myself the Third Eye Blind album (Out of Vein) that I’ve been wanting to get for so long (well, at least since it’s release last week, it felt like a long time). I’m a big Third Eye Blind fan - still listen to their very first album ever so often, Third Eye Blind. That’s a tough album to live up to, but from what I’ve heard so far of Out of Vein, they’re doing fine.

I also got No! from They Might Be Giants (they sang the theme song on Malcolm in the Middle, Boss of Me). They make the funniest and weirdest songs.

CM4 uses XML-based skinning

Championship Manager 4, the newest installation in the Championship Manager series of football management simulation games, uses XML-based skinning. It may be old news, CM4 being released 2 or 3 months ago, but I didn’t realise that until I checked out the sources for some CM4 skins, and much to my surprise, the only files I saw were XML files and images. Now not only is that very cool, it is also reassuring that game developers are taking the XML-based UI design paradigm seriously.

You can get CM4 skins from cmskins.com.

Interesting threads and XUL article at SitePoint

There’re some interesting threads over at SitePoint Forums:

Java or .NET — What to Learn??
Head-to-Head: PHP vs. ASP.NET

Also, Harry Fuecks from phpPatterns() has recently written an article on XUL entitled Introducing XUL - The ‘Net’s Biggest Secret: Part 1 for SitePoint. Nice introductory article, but he does seem to make it (XUL programming) more difficult than it actually is by involving the PHP bit.