ID: 14340
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Old Status: Feedback
Status: Open
Bug Type: DOM XML related
Operating System: Linux Debian Woody
PHP Version: 4.1.0
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2001-12-04 13:06:03] [EMAIL PROTECTED]
Wtf? Sorry, feedback.
------------------------------------------------------------------------
[2001-12-04 13:05:46] [EMAIL PROTECTED]
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] [EMAIL PROTECTED]
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
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]