note 60522 added to function.simplexml-element-xpath

From: Date: Tue, 10 Jan 2006 07:40:16 +0000
Subject: note 60522 added to function.simplexml-element-xpath
Groups: php.notes 
Request: Send a blank email to php-notes+get-101477@lists.php.net to get a copy of this message
here's a simple work-around for the lack of support for default namespaces, just overwrite the xmlns attribute of the root element: <?php $xml = simplexml_load_file('http://example.com/atom_feed.xml'); // hack to work around php 5.0's problems with default namespaces and xpath() $xml['xmlns'] = ''; // now our queries work: $titles = $xml->xpath('entry/title'); foreach ((array)$titles as $title) { print "$title\n"; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-element-xpath.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60522 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60522&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60522&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101477) next »