<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>onDeveloping &#187; php</title>
	<atom:link href="http://zbrustudios.com/onDeveloping/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://zbrustudios.com/onDeveloping</link>
	<description>thoughts on developing from zach mccorkhill @ z.bru studios</description>
	<lastBuildDate>Thu, 18 Nov 2010 22:02:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>on PHP and XML.</title>
		<link>http://zbrustudios.com/onDeveloping/2008/11/on-php-and-xml/</link>
		<comments>http://zbrustudios.com/onDeveloping/2008/11/on-php-and-xml/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 23:24:14 +0000</pubDate>
		<dc:creator>zach</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.zbrustudios.com/onDeveloping/?p=5</guid>
		<description><![CDATA[i’ve been working on a page for a client to have Amazon Associates and iTunes Affiliates links for a number of playlists (each w/100+ songs). i wish there were a pretty way of generating the links directly from the iTunes library file, but alas, i’ve spent many an hour watching tv and looking up the [...]]]></description>
			<content:encoded><![CDATA[<p>i’ve been working on a page for a client to have Amazon Associates and iTunes Affiliates links for a number of playlists (each w/100+ songs). i wish there were a pretty way of generating the links directly from the iTunes library file, but alas, i’ve spent many an hour watching tv and looking up the pertinent information for each song, and building XML pages using some crazy equations in Excel.<br />
there are many things to watch out for when creating XML files, and many as well when parsing an XML file with PHP.  one that i’m getting more and more familiar with is special characters. the ampersand character was one that really gave me pains. the iTunes data had the character &amp;, but XML uses &amp;amp;. to complicate things further, while PHP is parsing XML nodes, if it comes across the ampersand character it splits the data up. for example, i had a tag as follows:<br />
&lt;artist&gt;Huey Lewis &amp; The News&lt;/artist&gt;<br />
on the user end, PHP was only spewing “The News”. i couldn’t figure out a buen solution, try as i might to replace characters while the PHP was building the arrays. today i came across this post:<br />
<a href="“http://www.romej.com/archives/170/xml_parse-and-php-and-ampersands”" target="“_blank”">xml_parse() and php and ampersands</a>.<br />
thank goodness for that! turns out i can concatenate the parts into a lovely whole. check the link for a better explanation, but this is my example:<br />
before:<br />
case $xml_artist_key:<br />
$song_array[$counter]-&gt;artist = $data;<br />
break;</p>
<p>after:<br />
case $xml_artist_key:<br />
$song_array[$counter]-&gt;artist <span style="background-color:#FFFF33">.</span>= $data;<br />
break;<br />
voila!</p>
]]></content:encoded>
			<wfw:commentRss>http://zbrustudios.com/onDeveloping/2008/11/on-php-and-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

