I'm doing some work with the Discogs API trying to serialize the data of a release for use in another local application.
A release on Discogs is something like a music album, so it contains the tracklisting, artists, remixers etc.
Here is a sample track row returned from the API (xml)
<track>
<artists>
<artist>
<name>Ramirez</name>
<join>And</join>
</artist>
<artist>
<name>Tajada</name>
</artist>
</artists>
<title>Listen To The Drums</title>
<duration>8:10</duration>
</track>
Which more simply looks like this:
Ramirez And Tajada - Listen To The Drums
On this, I need to class the artist "Tajada" as a guest on this track, however, the "role" is defined in the previous artist's XML row:
<name>Ramirez</name>
<join>And</join>
How can I sort through the rows to 'swap' these around?
Ideally it would look like this:
<track>
<artists>
<artist>
<name>Ramirez</name>
</artist>
<artist>
<name>Tajada</name>
<join>And</join>
</artist>
</artists>
<title>Listen To The Drums</title>
<duration>8:10</duration>
</track>
Thanks for any help.