Bug #14340 Updated: DOMXML is broken
| From: | mfischer@php.net | Date: | Wed, 05 Dec 2001 01:58:19 +0000 |
| Subject: | Bug #14340 Updated: DOMXML is broken | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-72537@lists.php.net to get a copy of this message | ||
ID: 14340
Updated by: mfischer
Reported By: deftris@netcourrier.com
Old Status: Open
Status: Closed
Bug Type: DOM XML related
Operating System: Linux Debian Woody
PHP Version: 4.1.0
New Comment:
As i said, its not 'name' in this case but 'tagname'. This is the behaviour now.
Not a bug, closing.
Previous Comments:
------------------------------------------------------------------------
[2001-12-04 15:24:19] deftris@netcourrier.com
and the problem is the same under Debian Sid (unstable) /php4.1RC1 / libxml2 2.4.8
------------------------------------------------------------------------
[2001-12-04 15:23:05] deftris@netcourrier.com
print_r($xmlstring) works well, tough.
an example code:
_____________________________________________________
<?
$string = "<?xml version=\"1.0\"?>
<webcam_users>
<user>
<login>user1</login>
<password>passwd1</password>
</user>
<user>
<login>user2</login>
<password>passwd2</password>
</user>
<user>
<login>guest</login>
<password>guest_passwd</password>
</user>
</webcam_users>";
$doc = xmldoc($string);
$root = domxml_root($doc);
$users = domxml_children($root);
foreach ($users as $user){
if ($user->type == "1") {
$nom = $user-> name;
print "balise: ".$nom."<BR>";}
}
function find_content($parent,$name){
$nodes = $parent->children();
while($node = array_shift($nodes)) {
if ($node->name == $name){
return get_content($node);
}
}
?>
_______________________________________________
This code returns:
________________________________________
balise: user
balise: user
balise: user
___________________________________________
with php4.0.6 /libxml2 2.4.5
and nothing with php4.1RC1 / libxml2 2.4.8
------------------------------------------------------------------------
[2001-12-04 13:06:03] mfischer@php.net
Wtf? Sorry, feedback.
------------------------------------------------------------------------
[2001-12-04 13:05:46] mfischer@php.net
A sample script would help very much.
I think what you are searching for is actually 'tagname'.
If you're unsure, just try a
print_r($domobjnode);
and see its properties.
Feedback.
------------------------------------------------------------------------
[2001-12-04 11:55:04] deftris@netcourrier.com
VERSIONS:
PHP4.1RC1/libxml2 v2.4.8
PHP4.099/libxml2 v2.4.8
DESCRIPTION:
some methods seems to be not implemented:
$node->name doesn't work!it gives no output, no crash.
CONFIG OPTS:
'../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs'
'--with-regex=system' '--with-config-file-path=/etc/php4/apache'
'--disable-rpath' '--disable-debug' '--enable-memory-limit'
'--enable-calendar' '--enable-sysvsem' '--enable-sysvshm'
'--enable-track-vars' '--enable-trans-sid' '--enable-bcmath'
'--with-bz2' '--enable-ctype' '--with-db2' '--with-iconv'
'--with-ndbm' '--enable-exif' '--enable-filepro'
'--enable-ftp' '--with-gettext' '--enable-mbstring'
'--enable-mbstr-enc-trans' '--with-pcre-regex=/usr' '--enable-shmop'
'--enable-sockets' '--enable-wddx' '--with-xml=/usr'
'--with-expat-dir=/usr' '--enable-yp' '--with-zlib'
'--without-pgsql' '--disable-static' '--with-layout=GNU'
'--with-curl=shared,/usr' '--with-dom=shared,/usr'
'--with-zlib-dir=/usr' '--with-gd=shared,/usr'
'--with-jpeg-dir=shared,/usr' '--with-xpm-dir=shared,/usr/X11R6'
'--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/usr'
'--with-imap=shared,/usr' '--with-ldap=shared,/usr'
'--with-mcal=shared,/usr' '--with-mhash=shared,/usr' '--with-mm'
'--with-mysql=shared,/usr' '--with-recode=shared,/usr'
'--with-sablot=shared,/usr' '--with-snmp=shared'
'--with-sybase-ct=shared,/usr' '--with-ttf=shared,/usr'
'--with-t1lib=shared,/usr'
This is a relatively standart install from Debian Woody packages.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14340&edit=1