Hello computerzworld,
Is there a reason you don't just request the Atom feed in the first
place, rather than attempting to convert the JSON feed?
--
Trevor Johns
Ah, I see.
Unfortunately, there's no easy answer here. The only way that I know
of to do this is to walk through the JSON and manually create the
corresponding XML (either directly or using one of the client
libraries).
--
Trevor Johns
The problem is that JSON doesn't directly translate to XML. There's
features in each that aren't available in the other.
That's not to say it can't be done. But how it's done will depend on
the specifics of the situation: what you have as input, and what you
want as output.
Here's an article that discusses converting from XML to JSON (and vice
versa) just to give you an idea of the issues involved:
http://onwebdevelopment.blogspot.com/2008/05/converting-xml-to-json.html
As you can see, while it's possible, there's no standard way of handling this.
Now, there is some code out there that attempts to do this conversion
for you, provided you adhere to certain rules. The article above had
some JavaScript code to do this. I'm not familiar with any for PHP,
but I do know of a .NET one:
http://james.newtonking.com/archive/2006/07/11/656.aspx
If your data doesn't fit within their rules, or if you can't find a
PHP library, you'll need to write something yourself. At the very
least, there are classes in PHP that know how to parse XML and JSON.
You just have to write the rules to map between the two.
--
Trevor Johns