|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-12-04 11:55 UTC] deftris at netcourrier dot 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 09:00:01 2025 UTC |
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.8ok i modified the $node->name in $node->tagname the script: -------------------------------------------- <? $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->tagname; print "balise: ".$nom."<BR>"; print_r($user);} } function find_content($parent,$name){ $nodes = $parent->children(); while($node = array_shift($nodes)) { if ($node->tagname == $name){ return get_content($node); } } return ""; } ?> -------------------------------------------------- the result with PHP4.1RC1 /libxml2 v2.4.8: NOTHING! -------------------------------------------------- with PHP4.0.6 / libxml2 v2.4.5: balise: DomNode Object ( [name] => user [content] => user1 passwd1 [node] => Resource id #4 [type] => 1 ) balise: DomNode Object ( [name] => user [content] => user2 passwd2 [node] => Resource id #6 [type] => 1 ) balise: DomNode Object ( [name] => user [content] => guest guest_passwd [node] => Resource id #8 [type] = > 1 ) -------------------------------------------------- Before trying DOMXML, i downloaded latest PHP manual ... but ... help me I'm lost I don't underdstand... as you say $node->tagname should work ... if so, why do I have no output ??? If it's not a bug, what is the correct syntax? Please can you correct my script? (sorry, I'm aware that I make you loose your time) Thanks a lot!