I'm trying to make a page using data from the discogs.com (XML)-API. i've been parsing it with simpleXML and it's working pretty well but there is some things i'm not sure how to do.
Here is part of the XML:
<releases>
<release id="1468764" status="Accepted" type="Main">
<title>Versions</title>
<format>12", EP</format>
<label>Not On Label</label>
<year>1999</year>
</release>
<release id="72246" status="Accepted" type="Main">
<title>The M.O.F Blend</title>
<format>LP</format>
<label>Blenda Records</label>
<year>2002</year>
</release>
<release id="890064" status="Accepted" type="Main">
<title>The M.O.F Blend</title>
<format>CD</format>
<label>Blenda Records</label>
<year>2002</year>
</release>
<release id="1563561" status="Accepted" type="TrackAppearance">
<title>Ännu En Gång Vol. 3</title>
<trackinfo>Backtrack</trackinfo>
<format>Cass, Comp, Mix</format>
<label>Hemmalaget</label>
<year>2001</year>
</release>
</releases>
What i want to achieve is something similair to how discogs presents the releases: http://www.discogs.com/artist/Mics+Of+Fury where diferent versions of the same release are sorted together. (see. The M.O.F Blend in my link) This is done on discogs with having a master release that features the other releases. unfortunately this information isn't present in the API data, so i want to do the same thing by grouping the <release>
-nodes with the same <title>
-tags, or add a flag to the <releases>
that don't have a unique <title>
? any good ideas on the best way of doing this?
i also like to know if it's possible to count the <release>
-nodes (child of releases) that have the same type-attribute? like in this example count the releases with the type "Main"?
maybe it's better to do this things with XMLReader or XPath?