Skip to main content

Posts

Showing posts from September, 2012

XML parsing and Python: the lxml way

Today I was tinkering with an idea involving parsing a Html file by taking an XML structure and building a simple xquery engine in python.

I know...most of my "World changing ideas" finally end up on my unfinished/fragile Github Project category. But knowing how it's gonna help me in long drive I tried to give it a shot anyway.
And this is when I discovered lxml and immediately fell in love with it. But rather going to the intricacies I'm gonna share how simple it was for me to pars an xml file with it.
First, we'll make sure we have everything in place. Things we need lxml Yeah...that's kinda only thing you'll need :) (and of course Python!!!). If you are sing Ubuntu or Xubuntu (like me) then just goto synaptics package manager and install it. Or get it from the website if you are gonna tinker in windows.
Now, let's assume that we want to parse a xml file named 'file.xml' with the following content:



Now I want to get all the element_id for my…

The Ammazing iOS6 Maps

The new iOS6 Maps....And how they fare to Google Maps

We just had the grand release of iOS6 and with it the new Apple Map (yes...the one apple cooked up after abondoning Google Maps).

But it seems they were in a little hurry with it.
Just see the images below and please do come back with what you think ;)



There are many more of these examples sprawled acroos the net

So What's your take on this?