<?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: XPaths with PHP by example</title>
	<atom:link href="http://www.earthinfo.org/xpaths-with-php-by-example/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.earthinfo.org/xpaths-with-php-by-example/</link>
	<description>Down to Earth Information</description>
	<lastBuildDate>Wed, 01 Feb 2012 05:35:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: George Hafiz</title>
		<link>http://www.earthinfo.org/xpaths-with-php-by-example/comment-page-1/#comment-47482</link>
		<dc:creator>George Hafiz</dc:creator>
		<pubDate>Fri, 23 Sep 2011 13:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthinfo.org/?p=259#comment-47482</guid>
		<description>I used this for a little project to have at work - a live webcam image of the skyline across my city along with the current temperature, scraped from the met office website. Because the table grows throughout the day to display the temperature by hour, I wanted a position relative to the end of the table.

The &lt;b&gt;penultimate&lt;/b&gt; row (one before last) contained the cell with the latest temperature in. Accessing relative positions is easy in XPath!

http://www.metoffice.gov.uk/weather/uk/se/solent_latest_temp.html

$xpath-&gt;query(&quot;((//div[@id=&#039;obsTable&#039;]/table/tr)[last()-1])/td[3]&quot;);

This finds the div with id &#039;obsTable&#039; and selects the fourth cell of the &#039;&lt;b&gt;last - 1`th&lt;/b&gt;&#039; row. Job done!</description>
		<content:encoded><![CDATA[<p>I used this for a little project to have at work &#8211; a live webcam image of the skyline across my city along with the current temperature, scraped from the met office website. Because the table grows throughout the day to display the temperature by hour, I wanted a position relative to the end of the table.</p>
<p>The <b>penultimate</b> row (one before last) contained the cell with the latest temperature in. Accessing relative positions is easy in XPath!</p>
<p><a href="http://www.metoffice.gov.uk/weather/uk/se/solent_latest_temp.html" rel="nofollow">http://www.metoffice.gov.uk/weather/uk/se/solent_latest_temp.html</a></p>
<p>$xpath-&gt;query(&#8220;((//div[@id='obsTable']/table/tr)[last()-1])/td[3]&#8220;);</p>
<p>This finds the div with id &#8216;obsTable&#8217; and selects the fourth cell of the &#8216;<b>last &#8211; 1`th</b>&#8216; row. Job done!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.earthinfo.org/xpaths-with-php-by-example/comment-page-1/#comment-32753</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Thu, 12 May 2011 22:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthinfo.org/?p=259#comment-32753</guid>
		<description>Thanks for the great article... i have been playing with this for hours and yours is the only example that talks about trimming back the xpath query and removing the front elements... this worked a treat first time! Thanks you saved me hours of work...</description>
		<content:encoded><![CDATA[<p>Thanks for the great article&#8230; i have been playing with this for hours and yours is the only example that talks about trimming back the xpath query and removing the front elements&#8230; this worked a treat first time! Thanks you saved me hours of work&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.earthinfo.org/xpaths-with-php-by-example/comment-page-1/#comment-5299</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sat, 24 Jul 2010 12:24:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthinfo.org/?p=259#comment-5299</guid>
		<description>Thank you for writing this.  It helped me work out how to use DOMXPath!

I wanted to extract an rss feed from a html document if it existed.  Here&#039;s what I came up with:

$html = new DOMDocument();
@$html-&gt;loadHtmlFile(&#039;http://www.example.com&#039;);
$xpath = new DOMXPath( $html );
$nodelist = $xpath-&gt;query( &quot;//link[@rel=&#039;alternate&#039;]/@href&quot; );
foreach ($nodelist as $n){
echo $n-&gt;nodeValue.&quot;\n&quot;;
}</description>
		<content:encoded><![CDATA[<p>Thank you for writing this.  It helped me work out how to use DOMXPath!</p>
<p>I wanted to extract an rss feed from a html document if it existed.  Here&#8217;s what I came up with:</p>
<p>$html = new DOMDocument();<br />
@$html-&gt;loadHtmlFile(&#8216;<a href="http://www.example.com" rel="nofollow">http://www.example.com</a>&#8216;);<br />
$xpath = new DOMXPath( $html );<br />
$nodelist = $xpath-&gt;query( &#8220;//link[@rel='alternate']/@href&#8221; );<br />
foreach ($nodelist as $n){<br />
echo $n-&gt;nodeValue.&#8221;\n&#8221;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alin</title>
		<link>http://www.earthinfo.org/xpaths-with-php-by-example/comment-page-1/#comment-3571</link>
		<dc:creator>alin</dc:creator>
		<pubDate>Thu, 20 May 2010 08:10:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthinfo.org/?p=259#comment-3571</guid>
		<description>my Xpath expression for a value from web is : 

/html/body/div[@id=&#039;jive-forumpage&#039;]/table[3]/tbody/tr/td[1]/div[1]/div/table/tbody/tr[1]/td[3]/a[@id=&#039;jive-thread-1&#039;]

i can not query it. muss i remove tbody ?</description>
		<content:encoded><![CDATA[<p>my Xpath expression for a value from web is : </p>
<p>/html/body/div[@id='jive-forumpage']/table[3]/tbody/tr/td[1]/div[1]/div/table/tbody/tr[1]/td[3]/a[@id='jive-thread-1']</p>
<p>i can not query it. muss i remove tbody ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Серфим по XHTML/XML с помощью XPath и PHP &#187; proft.com.ua [Блог о Web, IT, life]</title>
		<link>http://www.earthinfo.org/xpaths-with-php-by-example/comment-page-1/#comment-317</link>
		<dc:creator>Серфим по XHTML/XML с помощью XPath и PHP &#187; proft.com.ua [Блог о Web, IT, life]</dc:creator>
		<pubDate>Tue, 14 Jul 2009 08:57:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthinfo.org/?p=259#comment-317</guid>
		<description>[...] XPath Tutorial - Advanced XML Part 1 A guide to using XPath with PHP to scrape web pages Web scraping with PHP and XPath Примеры по DOMDocument и DOMXPath Хорошее [...]</description>
		<content:encoded><![CDATA[<p>[...] XPath Tutorial &#8211; Advanced XML Part 1 A guide to using XPath with PHP to scrape web pages Web scraping with PHP and XPath Примеры по DOMDocument и DOMXPath Хорошее [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

