[eluser]anthrt[/eluser]
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, I'm using SimpleXML to parse the XML document.
Code:
<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:
Code:
<name>Ramirez</name>
<join>And</join>
How can I sort through the rows to 'swap' these around?
I can't figure out a way how to automatically detect the "join" in the previous artist element, and do some logic based on it within the next iteration of the loop.
I hope everyone can understand what i'm trying to get at, as I can't figure this out!
Regards