Re: XML element references/links.
| From: | Gabino Travassos | Date: | Tue, 27 Apr 2004 15:27:20 +0000 |
| Subject: | Re: XML element references/links. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184768@lists.php.net to get a copy of this message | ||
I started with "artist", although this won't work for compilation albums.
<artist website="http://www.jenkraatz.com"
name="Jen Kraatz">
<album title="Ashes EP" releaseDate="2003"
label="RounderRecords.xml" jpg_loc="http://www.jenkraatz.com/ashes.jpg">
<title length="4:16">Square</title>
<title length="3:21">A Bee</title>
<title length="14:32">Moon Jammies</title>
</album>
</artist>
I'm grouping mine by artist, then by album. In <album> I can get
myXML.child_nodes(1).child_nodes(1).length to find out how many songs there are and do a loop to
display them. The more loops the better. I can also myXML.child_nodes(1).length to find out how many
albums this artist has.
I try to cram as much <album> information into the attributes in the <album> tag. Since
this artist uses a record label that is common to other artists, I'll just link to an XML file
that has that label's information. Sort of a Relational Database model.
If I had a compilation album:
<artist website="" name="compilation">
<album title="Smokin' Beats" releaseDate="2004"
label="mysticRecords.xml" jpg_loc="http://www.mystic.com/smokinBeats.jpg">
<title length="4:21" artist="Rock Plaza Central>Quantum
Butterass</title>
<title length="5:12" artist="The Oblio Joes">Swallow the
Moon</title>
etc.
</album>
</artist>
HTH