Jump to content

Parsing XML with Simple XML


OriginalDavid

Recommended Posts

I'm trying to parse an XML file with Simple XML

 

Here's a part of the XML:

 

<CueList xmlns="urn:CueListSchema.xml" xmlns:s="urn:schemas-rcsworks-com:SongSchema" xmlns:n="urn:schemas-rcsworks-com:NoteSchema" xmlns:l="urn:schemas-rcsworks-com:LinkSchema" xmlns:t="urn:schemas-rcsworks-com:TrafficSchema" xmlns:p="urn:schemas-rcsworks-com:ProductSchema" xmlns:m="urn:schemas-rcsworks-com:MediaSchema" xmlns:w="urn:schemas-rcsworks-com:WebPageSchema" xmlns:ns="urn:CueListSchema.xml" time="2011-11-02T14:56:35">
<Event eventID="2" eventType="song" status="happening" scheduledTime="14:56:31" scheduledDuration="217.00">
<s:Song title="Mr.Brightside" internalID="0077000000025FA50000">
<s:Artist name="The Killers" sequenceNumber="1" internalID="0067000000020CB20000" sortName="The Killers"/>
<m:Media ID="{A9E1341C-A638-4048-B8B5-199667E69FA5}" runTime="217.03" fileName="{A9E1341C-A638-4048-B8B5-199667E69FA5}.wav"/>
</s:Song>
</Event>
</CueList>

 

Now, I've got it to read the first part <event>

 

foreach ($CueList->Event as $event) {

 

$type = $event['eventType'];

 

}

 

 

but I now want to read the Song Title on the next row down, and I'm having an issue with the s:Song part?

 

Any idea how I would do this, or even what you'd call that so I can look it up?

 

Thanks,

David

Link to comment
https://forums.phpfreaks.com/topic/250295-parsing-xml-with-simple-xml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.