If PHP/python isn't a hard requirement, I think this would be fairly simple to do in perl using a combination of the XML::Simple  and JSON::XS  modules.
In fact it's so simple, here's the code: """ #!/usr/bin/perl use JSON::XS; use XML::Simple; use strict; my $filename = shift @ARGV; my $parsed = XMLin($filename); my $json = encode_json($parsed); print $json, "\n"; """ XML::Simple, in spite of the name, actually allows for a myriad of options for how the perl data structure gets created from the xml, including attribute preservation, grouping of elements, etc. --jay  http://search.cpan.org/~grantm/XML-Simple-2.18/lib/XML/Simple.pm  http://search.cpan.org/~makamaka/JSON-2.17/lib/JSON.pm On Fri, Mar 5, 2010 at 9:55 AM, Joe Hourcle <onei...@grace.nascom.nasa.gov> wrote: > On Fri, 5 Mar 2010, Godmar Back wrote: > >> On Fri, Mar 5, 2010 at 3:59 AM, Ulrich Schaefer >> <ulrich.schae...@dfki.de>wrote: >> >>> Hi, >>> try this: http://code.google.com/p/xml2json-xslt/ >>> >>> >> I should have mentioned that I already tried everything I could find after >> googling - this stylesheet doesn't meet the requirements, not by far. It >> drops attributes just like simplexml_json does. >> >> The one thing I didn't try is a program called 'BadgerFish.php' which I >> couldn't locate - Google once indexed it at badgerfish.ning.com > > http://web.archive.org/web/20080216200903/http://badgerfish.ning.com/ > > http://web.archive.org/web/20071013052842/badgerfish.ning.com/file.php?format=src&path=lib/BadgerFish.php > > -Joe >