simplexml and xpath
| From: | Matthew Sims | Date: | Tue, 21 Sep 2004 18:41:39 +0000 |
| Subject: | simplexml and xpath | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197452@lists.php.net to get a copy of this message | ||
So I've just recently fallen in love with simplexml. But from what I've
read, is it true that xpath doesn't really work properly?
I'm using an XML file that has a section like this:
<item>
<title>Title</title>
<link>Link</link>
<description>Desc</description>
<dc:subject>Subject</dc:subject>
<dc:date>2004-09-20T18:15:00+00:00</dc:date>
</item>
My sample of my PHP code is:
<?php
$library = simplexml_load_file('file.rss');
foreach ($library->item as $item) {
echo $item->xpath('dc:date');
}
?>
I just want to get the date. Am I doing xpath incorrectly or does xpath
not currently work properly in PHP5?
--
--Matthew Sims
--<http://killermookie.org>