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:
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.
On Fri, Mar 5, 2010 at 9:55 AM, Joe Hourcle
<[log in to unmask]> wrote:
> On Fri, 5 Mar 2010, Godmar Back wrote:
>> On Fri, Mar 5, 2010 at 3:59 AM, Ulrich Schaefer
>> <[log in to unmask]>wrote:
>>> 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