Home & blog  /  2010  /

posted: 02 Dec '10 18:55 tags: XML, JSON, remap, convert, data, AJAX, jQuery

I've had a great response to my XML-to-JSON convertor and remapper. Its ability to not only convert but also remap data on the fly, to your precise structural requirements, has gone down particularly well.

One flaw raised today, though, was that it didn't work with RSS fees. Standard XML feeds, yes, but not RSS. After some digging I realised why.

The plugin expected the iteration node (i.e. the repeated node whose data will form the sub-objects of your JSON data) to directly follow the root node, e.g.

1

2    

3         foo

4         bar.html

5    

6

But if your XML had more levels - such as the following, typical of RSS:

1

2    

3        

4             foo

5             bar.html

6        

7    

8

...it didn't play ball. This has been countered by the addition of a new second argument when calling the plugin, in which you pass a space-separated selector string matching the iteration node, so for the above two examples this would be 'root news_story' and 'rss channel news_story', respectively.

Happy days! to download, get usage info or view a demo.

I've also been asked about whether the plugin supports XML node attributes. No, but it will. Stay posted...

XML-to-JSON convertor and remapper

posted: 24 Nov '10 22:45 tags: XML, JSON, remap, convert, data, AJAX, jQuery

After much hair-pulling and cursing, my XML-to-JSON convertor and remapper is finally here.

The real power behind this plugin is its ability to not only convert but also REMAP your data on the fly. There are other plugins out there that handle conversion, but I've not seen any that also remap.

This has the potential to be hugely useful.

Imagine you're using a news ticker that requires JSON data (for the headlines, URLs etc), but you want to populate it with data from an XML feed you don't have control over, and whose property names and hierarchical structure is different from what your ticker needs:

1

2     foo

3     bar

4    

5         foobar

6    

7

but you need

1{

2     one: 'foo',

3     two: 'bar',

4     three: 'foobar'

5}

...so not only a conversion but also a structural change. You can achieve that with this plugin.

Head over here to download, get usage info or view a demo.

post a comment

Table sorter: toggling sort direction

posted: 20 Nov '10 21:11 tags: table, sort, Saul, community

A quick thanks to Saul, who took an interest in my table sort script and developed a way to toggle the sort direction when a column heading is re-clicked. That is, the first time it's clicked the table column is sorted in ascending order; if clicked again, in descending order.

For full details, check out Saul's comment on the script page over here.

post a comment

Blockster - fixed for jQuery v1.4.3

posted: 28 Oct '10 14:00 tags: block, transition, effect, rotation, slideshow, Javascript, jQuery

Thanks for the reports that Blockster wasn't working with the latest release of jQuery, 1.4.3. This is now fixed, and you can re-download the source here.

I would hesitate to say this was a jQuery bug, but it certainly seemed like one. For some reason, values set via the .css() method were being set, but read back as 0, e.g.

1$('#something').css({left: 15+'px', top: 20+'px'});

2alert($('#something').css('left')); //alerts 0px, not 15px

In jQuery 1.4.2, there was no issue. Anyway, some fudge later involving tracker variables, this is fixed. Phew.

2 comments | post new
older posts >