Tag Archives: xml

Our New Blog – A Groovy Journey

Posted on by

After several years of running our blog on Pebble we’ve made the move to WordPress, and it’s pretty exciting! But how did we get here? It turns out that migrating a blog from an unsupported platform is not very difficult, all you need is a bit of programming know-how and in a couple of hours you’ll be migrated!

Pebble stores all of its data in XML files on the server, WordPress data can be imported from WordPress eXtended RSS format. XML to XML pretty straightforward, you just need to pick a language! I figured I would try out Groovy since it seemed to offer some nice api’s for processing and producing XML.
read more »

Working with large XML files

Posted on by

I recently ran up against a large XML file and legacy code that manipulated it.. the code had mysteriously stopped working, there were no unit tests and the XML file was large and had no line breaks. What do you do in this situation?

Loading the 30MB file in any kind of editor made the editor slow. Trying to format the file left the editors unresponsive. There’s no point in doing a grep find on a one line XML file, and while writing a cleanup script to add line breaks makes life better, why reinvent the wheel? Googling yielded several windows programs at first, but digging further, and using social networking finally produced two fantastic products for unix/linux based OS!

xmllint
The first and easiest tool to use turns out to be xmllint! It’s most likely available with your unix/linux distribution just type it at the command prompt. Running xmllint –format my_file.xml > my_file_formated.xml will add line breaks where they make sense in your XML file. Now you can easily perform a grep find, you’re halfway there!

XML-Twig
This perl program was the icing on the cake! You can download it here: http://search.cpan.org/dist/XML-Twig/ and then all you need to do is install it using the provided Makefile and you’re up and running. How did this help? Well among the hundreds of options provided with XML-Twig there’s a tool called xml_split. Just type xml_split my_file.xml and it will split your large unreadable file into manageable smaller ones. You can find more information about the usage here: http://search.cpan.org/dist/XML-Twig/tools/xml_split/xml_split

With just these two tools it’s easy to write unit tests against smaller sections of the XML file. It’s also easy to find the problematic sections in the XML file and easier to make changes and to test the fix!

What tools do you use?

XX Framework – ett nytt webbramverk för Java

Posted on by

Eller nytt och nytt, har funnits i ett drygt år, verkar det som, men jag har aldrig hört talas om det förut. XX i XX Framework står för XML och XSLT.

The primary goal of the XX Framework is to handle typical application CRUD (create, retrieve, update, delete) with little or no Java programming. Instead of telling the application how to retrieve and how to display the data, we configure what to retrieve (through XML) and what to display (through XSLT).

Inget om man har aversioner mot XML, tydligen, men kanske helt rätt om enkel CRUD är ens sweet spot. Fast då kanske man ska använda Trails istället?

JSLT – ett javascript-baserat alternativ till XSLT

Posted on by

Jag har alltid varit skeptisk till X-et i Ajax, dvs XML. Varför skapa och skicka ett så bökigt format som XML från servern, för att sedan processas i JavaScript, ett språk som inte så många är duktiga på? Nu har Rik Arends skapat JSLT, som ger möjlighet att processa XML med hjälp av JavaScript-syntax som liknar XSLT. Nu är XSLT i och för sig ett språk som inte ens en mor kan älska, men det kan vara väldigt kraftfullt vid rätt tillfälle.