<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 25 May 2013 21:22:45 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[James Morris' Blog: Parsing HTML with DOMDocument and DOMXPath::Query]]></title>
      <guid>http://www.phpdeveloper.org/news/18145</guid>
      <link>http://www.phpdeveloper.org/news/18145</link>
      <description><![CDATA[<p>
In the latest post to his blog <i>James Morris</i> looks at <a href="http://blog.jmoz.co.uk/domdocument-domxpath-html-parsing">using XPath's query() function</a> to locate pieces of data in your XML.
</p>
<blockquote>
The other day I needed to do some html scraping to trim out some repeated data stuck inside nested divs and produce a simplified array of said data. My first port of call was SimpleXML which I have used many times. However this time, the son of a bitch just wouldn't work with me and kept on throwing up parsing errors. I lost my patience with it and decided to give DomDocument and DOMXpath a go which I'd heard of but never used.
</blockquote>
<p>
He includes a code (and XML document) example showing how to extract out some content from an HTML structure - grabbing each of the images from inside a div and associating them with their description content.
</p>]]></description>
      <pubDate>Wed, 27 Jun 2012 10:19:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Thomas Weinert's Blog: Using PHP DOM With XPath]]></title>
      <guid>http://www.phpdeveloper.org/news/14342</guid>
      <link>http://www.phpdeveloper.org/news/14342</link>
      <description><![CDATA[<p>
<i>Thomas Weinert</i> has a recent post to his blog showing <a href="http://www.a-basketful-of-papayas.net/2010/04/using-php-dom-with-xpath.html">how to use</a> one of the more powerful XML-handling features that PHP's DOM extension includes - XPath.
</p>
<blockquote>
Often I hear people say "We use SimpleXML, because DOM is so noisy and complex". Well, I don't think so. This article explains how you can parse a XML (an Atom feed) using the PHP DOM extension. No other libraries are involved.
</blockquote>
<p>
In his example he loads an external feed (his own) into a DOM object, blocks any errors with a few handy functions and creates a DOMXPath object on the DOM object to get ready for his queries. He shows how to make searches for titles, subtitles, looping over attributes and an element list returned from one of the first queries. A full code listing is also provided to show how it all fits together.
</p>]]></description>
      <pubDate>Tue, 13 Apr 2010 13:18:32 -0500</pubDate>
    </item>
  </channel>
</rss>
