Some XML help

Associate
Joined
13 Nov 2003
Posts
1,567
Location
Manchester
Hi Guys

Working on creating a database driven xml feed for a flash application.

I can out output the data in a valid xml format using the following

Code:
 $_xml .="\t<song title=\"" . $row["TitleOfTrack"] . "\">\r\n";
 $_xml .="\t\t<artist>Nicksy</artist>\r\n";
 $_xml .="\t\t<src>" . $row["FilenameOfTrack"] . "</src>\r\n";
$_xml .="\t</song>\r\n";

Which gives me

Code:
	<playlist>
−
	<song title="Nicksy's Cottage Chat">
<artist>Nicksy</artist>
<src>radio-show/NicksysCottageChatJULY_1.mp3</src>
</song>
−
	<song title="Nicksy's Cottage Chat">
<artist>Nicksy</artist>
<src>radio-show/NicksysCottageChatJULY.mp3</src>
</song>
−
	<song title="Nicksy's Cottage Chat June16th">
<artist>Nicksy</artist>
<src>radio-show/CottageChat16thJUneMP3.mp3</src>
</song>
−
	<song title="Cottage Chat June3rd">
<artist>Nicksy</artist>
<src>radio-show/CottageChatJune3rd.mp3</src>
</song>
−
	<song title="Cottage Chat June 2">
<artist>Nicksy</artist>
<src>radio-show/CottageChatJuneWeek2.mp3</src>
</song>
−
	<song title="Cottage Chat June">
<artist>Nicksy</artist>
<src>radio-show/CottageChatJUNEMP3.mp3</src>
</song>
−
	<song title="Week 2">
<artist>Nicksy</artist>
<src>radio-show/CottageChatFINALmix.mp3</src>
</song>
−
	<song title="Week 1">
<artist>Nicksy</artist>
<src>CottageChatWeek1.mp3</src>
</song>
</playlist>

However, the flash app needs the xml to look more like this

Code:
<playlist>
<song title="songtitle" artist="artist" src="filenameoftrack" />
</playlist>

How would I modify the code above to achieve this. Im fairly certain its not valid XML, but it seems to be the way the flash app wants it, and I have no control over that.

Thanks
Aaron
 
Back
Top Bottom