<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: XPath in SimpleXML</title>
	<atom:link href="http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/</link>
	<description>Waiting for your comments</description>
	<lastBuildDate>Mon, 15 Mar 2010 02:10:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: boxoft</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-15624</link>
		<dc:creator>boxoft</dc:creator>
		<pubDate>Wed, 02 Dec 2009 04:45:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-15624</guid>
		<description>Very good tutorial. Thank you very much.</description>
		<content:encoded><![CDATA[<p>Very good tutorial. Thank you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joyce</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-12014</link>
		<dc:creator>Joyce</dc:creator>
		<pubDate>Sun, 30 Aug 2009 22:11:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-12014</guid>
		<description>Great blog you got here...keep up the good work.</description>
		<content:encoded><![CDATA[<p>Great blog you got here&#8230;keep up the good work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dimuthu</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-11418</link>
		<dc:creator>dimuthu</dc:creator>
		<pubDate>Tue, 11 Aug 2009 14:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-11418</guid>
		<description>Yea. It always returns an array.</description>
		<content:encoded><![CDATA[<p>Yea. It always returns an array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guillermo</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-11417</link>
		<dc:creator>Guillermo</dc:creator>
		<pubDate>Tue, 11 Aug 2009 14:24:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-11417</guid>
		<description>Ah! Now I understand. This was making the difference:

echo $description[0];

I was just using

echo $description;

Then results should always use $x[0] index, even if they are a unique element. Right?</description>
		<content:encoded><![CDATA[<p>Ah! Now I understand. This was making the difference:</p>
<p>echo $description[0];</p>
<p>I was just using</p>
<p>echo $description;</p>
<p>Then results should always use $x[0] index, even if they are a unique element. Right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guillermo</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-11416</link>
		<dc:creator>Guillermo</dc:creator>
		<pubDate>Tue, 11 Aug 2009 13:34:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-11416</guid>
		<description>Thanks a lot. I appreciate your solution. I´ll try it.

Is it working bacause of this call:
$xml = new SimpleXMLElement($xml_str);

instead of this one?:
$xml = simplexml_load_file ($xml_str);

Then i should load the text by include() and then convert it to SimpleXMLElement...</description>
		<content:encoded><![CDATA[<p>Thanks a lot. I appreciate your solution. I´ll try it.</p>
<p>Is it working bacause of this call:<br />
$xml = new SimpleXMLElement($xml_str);</p>
<p>instead of this one?:<br />
$xml = simplexml_load_file ($xml_str);</p>
<p>Then i should load the text by include() and then convert it to SimpleXMLElement&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luis</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-11404</link>
		<dc:creator>Luis</dc:creator>
		<pubDate>Tue, 11 Aug 2009 08:07:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-11404</guid>
		<description>Perfectly easy! thanks!</description>
		<content:encoded><![CDATA[<p>Perfectly easy! thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dimuthu</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-11392</link>
		<dc:creator>dimuthu</dc:creator>
		<pubDate>Tue, 11 Aug 2009 02:07:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-11392</guid>
		<description>This worked!
&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;&lt;?php&lt;/span&gt;
&#160;
&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$xml_str&lt;/span&gt; = &lt;&lt;&lt;XML
&lt;a&gt;
  &lt;b&gt;
    &lt;album foto=&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;a2.jpg&quot;&lt;/span&gt;&gt;

        &lt;titulo&gt;found&lt;/titulo&gt;
    &lt;/album&gt;
  &lt;/b&gt;
&lt;/a&gt;
XML;
&#160;
&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$xml&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;new&lt;/span&gt; SimpleXMLElement&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$xml_str&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;

&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$busqueda&lt;/span&gt; = &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;//album[@foto=&#039;a2.jpg&#039;]/titulo&quot;&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$description&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$xml&lt;/span&gt;-&gt;&lt;span style=&quot;color: rgb(0, 102, 0);&quot;&gt;xpath&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$busqueda&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;
&#160;
&#160;

&lt;a href=&quot;http://www.php.net/echo&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 102);&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$description&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: rgb(204, 102, 204);&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;]&lt;/span&gt;;
&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;?&gt;&lt;/span&gt;</description>
		<content:encoded><![CDATA[<p>This worked!<br />
<span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;?php</span><br />
&nbsp;<br />
<span style="color: rgb(0, 0, 255);">$xml_str</span> = &lt;&lt;&lt;XML<br />
&lt;a&gt;<br />
  &lt;b&gt;<br />
    &lt;album foto=<span style="color: rgb(255, 0, 0);">&#8220;a2.jpg&#8221;</span>&gt;</p>
<p>        &lt;titulo&gt;found&lt;/titulo&gt;<br />
    &lt;/album&gt;<br />
  &lt;/b&gt;<br />
&lt;/a&gt;<br />
XML;<br />
&nbsp;<br />
<span style="color: rgb(0, 0, 255);">$xml</span> = <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> SimpleXMLElement<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$xml_str</span><span style="color: rgb(102, 204, 102);">)</span>;</p>
<p><span style="color: rgb(0, 0, 255);">$busqueda</span> = <span style="color: rgb(255, 0, 0);">&#8220;//album[@foto='a2.jpg']/titulo&#8221;</span>;<br />
<span style="color: rgb(0, 0, 255);">$description</span> = <span style="color: rgb(0, 0, 255);">$xml</span>-&gt;<span style="color: rgb(0, 102, 0);">xpath</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$busqueda</span><span style="color: rgb(102, 204, 102);">)</span>;<br />
&nbsp;<br />
&nbsp;</p>
<p><a href="http://www.php.net/echo" rel="nofollow"><span style="color: rgb(0, 0, 102);">echo</span></a> <span style="color: rgb(0, 0, 255);">$description</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 102, 204);">0</span><span style="color: rgb(102, 204, 102);">]</span>;<br />
<span style="color: rgb(0, 0, 0); font-weight: bold;">?&gt;</span></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guillermo</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-11389</link>
		<dc:creator>Guillermo</dc:creator>
		<pubDate>Tue, 11 Aug 2009 01:46:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-11389</guid>
		<description>Why this doesn´t work?





Con titulo


Con atom




$busqueda = &quot;//album[@foto=&#039;a2.jpg&#039;]/titulo&quot;;
$descripcion = $xml-&gt;xpath($busqueda);</description>
		<content:encoded><![CDATA[<p>Why this doesn´t work?</p>
<p>Con titulo</p>
<p>Con atom</p>
<p>$busqueda = &#8220;//album[@foto='a2.jpg']/titulo&#8221;;<br />
$descripcion = $xml-&gt;xpath($busqueda);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dimuthu</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-10821</link>
		<dc:creator>dimuthu</dc:creator>
		<pubDate>Sun, 26 Jul 2009 04:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-10821</guid>
		<description>If you want to do xslt processing and work with DOM, that best thing you can do is forget simplexml and rather use dom in all the places.
You can use &lt;a href=http://php.net/domxpath rel=&quot;nofollow&quot;&gt;DOMXPath&lt;/a&gt; class to do xpath queries with DOM.

Thanks
Dimuthu</description>
		<content:encoded><![CDATA[<p>If you want to do xslt processing and work with DOM, that best thing you can do is forget simplexml and rather use dom in all the places.<br />
You can use <a href=http://php.net/domxpath rel="nofollow">DOMXPath</a> class to do xpath queries with DOM.</p>
<p>Thanks<br />
Dimuthu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jonas</title>
		<link>http://www.dimuthu.org/blog/2008/09/30/xpath-in-simplexml/comment-page-1/#comment-10802</link>
		<dc:creator>jonas</dc:creator>
		<pubDate>Sat, 25 Jul 2009 17:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.dimuthu.org/?p=416#comment-10802</guid>
		<description>Can anyone please inform how to turn the resulting array of an xpath query into a DomDocument for xslt processing?</description>
		<content:encoded><![CDATA[<p>Can anyone please inform how to turn the resulting array of an xpath query into a DomDocument for xslt processing?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
