XML with JSON

I have added a link to an article under the ‘Pages’ link on the top left hand side of the main NetThreads page (GWT: XML with JSON). This details the steps required to load existing xml data into a GWT (Google Web Toolkit) application, convert it to JSON format and then process it using the JSON classes supplied as part of Googles toolkit samples.

This should prove useful to anyone who wants to pull in their XML data to a GWT client application. It also provides an simple illustration of extracting data from a JSON structure.

Moving forward

I have finally cracked the problems I was having with rewriting gTraffic code for the v2.0 of the Google maps API. I was getting a null value back as a the xml document when a layer of the road data was requested. I could not figure out what was wrong as it only did it if you selected a ‘region’ from the panel, the map was fine. Well, I am still not sure what is the cause but it seems that any ‘GXmlHttp’ object you create has to have global scope. As soon as I made the request object global the problem went away. This has been bugging me for about two weeks and was putting me off from working on the site so hurray!

So whats changed? A few things..

– the new API calls are use instead.

– ditched GxMarker class as it wasn’t compatible with the v2.0 maps.

– redesigned the xml format for the layers. The new format is much tidier and has lost the flabby extraneous stuff which wasn’t needed.

On the down side there are a few things about the new version of the maps I don’t like:

– really slow compared to v1.o.

– they flipped the zoom level meaning which was thoroughly annoying.

– the infowindows don’t clear when you click elsewhere on the map. This is frustrating as you have to pull the whole infowindow into view to close it from the x icon.

They added support for tooltips but they are a bit crap so I have used a different approach. The new tooltips are not transparent anymore which was always something that was a bit of accident rather than design.

So, how long will it take me to finish? Let me get back to you on that one.

The road ahead

I thought I was finished with the TPEG DOM parser but I started to write some example apps and I confess I have got bogged down. I could release the code tomorrow but I am so close to finishing some cool examples that I cannot bring myself to do it without polishing them up to something worth looking at.

The deadline for the version 1 API for Google Maps looms and I am hoping that I will finish this parser stuff off before I have to look at this. I might have to put the parser stuff on hold. This is a shame cos I really think there is a lot of interesting bits in the examples. AJAX, Python, the DOM and some interesting Python tricks . The way I hear it Google are going to yank the V1 API any day so if the site goes down then you will know why. Rest assured I am working on it!

Thanks to everyone for their kind words on StumbledUpon and in email. I hear you and will try to make the site as good as it can be.

The new site might not look too different (until I get time to look at it) but I have cracked the problem of categorising events (the XML is so generalised) so that you will be able to see the exact reason for an event like ‘Traffic Lights’, ‘ Heavy Load’ etc. Before it was all a little bit general.

Outages

I have been noticing some outages of this site and the gtraffic site recently. My initial thought was that it was my ISP but I have tracked the problem down to the URL ‘forwarding’. This has got me thinking about moving the URL’s over to my main ISP but can’t decide what to do. Apologies to everyone who uses gtraffic. I hope this was just a glitch.

The TPEG dom parser is basically finished but I can’t bring myself to release it with out polishing up a few things. Interestingly one of the examples I had in mind was the generation of html for mobile phones. I was looking at the prototypes section of the bbc backstage site and noticed that a Tom Dyson has done something with this already here. I like his implementation, simple and straightforward. My plan is to generate something similar for the gtraffic site using the new parser code. The new parser is able to tease the event category from the TPEG xml (something which isn’t that easy). So (somehow) you should be able to sort the results for a particular severity, category etc. That’s the plan anyway.

I have ditched the idea of an AJAX rss reader for the RSS generated traffic data as it’s way too complicated to get bogged down in just now. I have spent enough time working on this stuff and I need to revamp the gtraffic site to use Google Maps API 2.0.

Processing…

I have finished the TPEG DOM parser. Still working on some examples. This, of course, has got completely out of hand since all sorts of interesting ideas popped into my head when I through about how to present the data. The main thing I am working on now is a AJAX driven OPML/RSS page which uses XSL to render the XML files into the appropriate panes of a webpage. The approach means that all of the processing is handled by the browser as long as the data is accessible either locally or held on the server side.

This might take a little while to do.