I've been trying to use zend dom but i've been having some issues so was
wondering if someone could tell me if this was possible...
XML:
<channel>
.....
<item>
<title>Flu drugs 'unhelpful' in children</title>
<description>Experts are questioning the policy of giving
antiviral drugs to children for swine flu saying it may do
more harm than good.</description>
<link>
http://news.bbc.co.uk/go/rss/-/1/hi/health/8193012.stm</link>
<guid isPermaLink="false">
http://news.bbc.co.uk/1/hi/health/8193012.stm</guid>
<pubDate>Mon, 10 Aug 2009 10:34:55 GMT</pubDate>
<category>Health</category>
<media:thumbnail width="66" height="49"
url="http://newsimg.bbc.co.uk/media/images/46182000/jpg/_46182934__46005163__45987312__45705292_tamiflu226i-1-1-1.jpg"
/>
</item>
<item>
<title>MI6 'is not complicit' in torture</title>
<description>The head of MI6 Sir John Scarlett tells the BBC
the British secret service has not been involved with
torture.</description>
<link>
http://news.bbc.co.uk/go/rss/-/1/hi/uk/8188307.stm</link>
<guid isPermaLink="false">
http://news.bbc.co.uk/1/hi/uk/8188307.stm</guid>
<pubDate>Mon, 10 Aug 2009 09:41:33 GMT</pubDate>
<category>UK</category>
<media:thumbnail width="66" height="49"
url="http://newsimg.bbc.co.uk/media/images/46181000/jpg/_46181968_raw_johnscarlett2_getty.jpg"
/>
</item>
................
This is taken off the bbc so i just grab the xml feed and then run it...
this is the PHP:
$dom = new Zend_Dom_Query();
$dom->setDocumentXml($xml);
$results = $dom->queryXpath( 'channel/item' );
this returns all the item elements which is correct. Now what i wish to do
is loop through those and run some xpath queries on that to get the
individual tags(e.g. category, title, link). Can't seem to figure this out
as if i loop through the results all i get is the string which i can't
navigate anymore.
--
View this message in context:
http://www.nabble.com/Zend_Dom-tp24898266p24898266.html
Sent from the Zend Framework mailing list archive at Nabble.com.