Uddhava - 2008-03-27

I could use some more examples with standard xml files to figure out how it works.
I dont have a lot of experience with php and arrays, so it might be me, but more examples might be helpfull.

for example consider this xml file :

<?xml version="1.0" encoding="UTF-8" ?>
<files>
  <file name="JAS_Sem_Psychology108_Part1_July_1997.mp3" source="original">
  <format>64Kbps MP3</format>
  <title>Seminar - Psychology 108 - part 1</title>
  <creator>H.H. Jayadvaita Swami</creator>
  <album>jul 1997</album>
  <track>01</track>
  <md5>3e60ee4bd3bd1de529f7084739e90cb5</md5>
  <sha1>1c065c2c47e2a2ac36b5976cd15e5954ddbd889d</sha1>
  </file>
  <file name="JAS_Sem_Psychology108_Part2_July_1997.mp3" source="original">
  <format>64Kbps MP3</format>
  <title>Seminar - Psychology 108 - part 2</title>
  <creator>H.H. Jayadvaita Swami</creator>
  <album>jul 1997</album>
  <track>02</track>
  <md5>48463a145a08b13417c2f5b08b1e88a7</md5>
  <sha1>7e3ec22942e7f740e6afca19d4340d242cf67320</sha1>
  </file>
</files>

how would i display the name of the file? (as it is part of the <file name="xxxxx"> tag?)
And how can i display only 1 item from a xml file instead of using foreach loops all the time like this :

    // Start a new DOM Document
    $rss3 = new rss_php;
    // Construct the filename of the meta data
    $datafile = $item['identifier']."_files.xml";
    echo "data file name : ".$datafile."<br />";
    // Read the META data XML File for this identifier
    $rss3->load($datafile);
    // Load the items from the metafile
    $fileinfo = $rss3->getValues();
   
    print_r($fileinfo);echo "<br />";
   
    // Lets prints some info from this file
    foreach($fileinfo as $index => $files) {
    echo "Format : ".$files['format']."<br />";
    }

This code does not work in displaying the format because there are "more" format for each file"

the array looks like this btw :

Array ( [files] =>
Array ( [file:0] => Array (
             [format] => 64Kbps MP3
             [title] => Seminar - Psychology 108 - part 1
             [creator] => H.H. Jayadvaita Swami
             [album] => jul 1997
             [track] => 01
             [md5] => 3e60ee4bd3bd1de529f7084739e90cb5
             [sha1] => 1c065c2c47e2a2ac36b5976cd15e5954ddbd889d )
        [file:1] => Array (
             [format] => 64Kbps MP3
             [title] => Seminar - Psychology 108 - part 2
             [creator] => H.H. Jayadvaita Swami
             [album] => jul 1997
             [track] => 02
             [md5] => 48463a145a08b13417c2f5b08b1e88a7
             [sha1] => 7e3ec22942e7f740e6afca19d4340d242cf67320 )
        [file:2] => Array (
             [format] => 64Kbps MP3
             [title] => Seminar - Psychology 108 - part 3
             [creator] => H.H. Jayadvaita Swami
             [album] => jul 1997
             [track] => 03
             [md5] => fc818a630a0e4dbf2eda6d97fb8b46fb
             [sha1] => eaacbee0ce5c916a3adeefba9631aec575ce7b3e )
) )