<?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>Geek is a lifestyle &#187; XML</title>
	<atom:link href="http://blog.amanjain.com/tag/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.amanjain.com</link>
	<description>Aman's Blog</description>
	<lastBuildDate>Wed, 06 Jan 2010 10:47:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Parse XML with php</title>
		<link>http://blog.amanjain.com/2008/12/xml-php/</link>
		<comments>http://blog.amanjain.com/2008/12/xml-php/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 08:41:05 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.amanjain.com/?p=22</guid>
		<description><![CDATA[Times may come when you want to parse an XML page with php .. or read feeds with php. &#8220;So, how to do it ?&#8221; .. is the question..
Here&#8217;s it:
$fileURL = &#8220;./fileName.xml&#8221;;  //Specify the path(or Link of the xml file. )
$string = file_get_contents($fileURL);  //This will load the wole content of xml file into the variable.
$xml [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-23" title="xml php" src="http://blog.amanjain.com/wp-content/uploads/2008/12/xmllogo-300x180.png" alt="xml php" width="210" height="81" />Times may come when you want to parse an XML page with php .. or read feeds with php. &#8220;So, how to do it ?&#8221; .. is the question..</p>
<p>Here&#8217;s it:</p>
<p>$fileURL = &#8220;./fileName.xml&#8221;;  //Specify the path(or Link of the xml file. )<br />
$string = file_get_contents($fileURL);  //This will load the wole content of xml file into the variable.<br />
$xml = simplexml_load_string($string);  //simplexml_load_string, loads the data inform of an object or returns false if there is a problem in xml</p>
<p>if($xml !== false) //checks weather xml was sucessfully loaded<br />
{</p>
<p>//now suppose we want to list down all the attributes of tag <strong>FIRST ModulePrefs</strong> tag i.e &lt;ModulePrefs &#8230;. &gt;&lt;/&#8230;&gt;<br />
foreach($xml-&gt;ModulePrefs[0]-&gt;attributes() as $a =&gt; $b)  \\ [0] means the first ModulePrefs tag<br />
{<br />
echo $a = $b \\here $a is the attribute and $b is the value.<br />
}<br />
}</p>
<p>Easy isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amanjain.com/2008/12/xml-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
