php-developer-list | 2001122
Date: 12/16/01
- Next message: mfischer <email protected>: "[PHP-DEV] Bug #14545 Updated: DOM seems not to work"
- Previous message: yohgaki <email protected>: "[PHP-DEV] Bug #14224 Updated: fgets(), fgetc() stalls"
- Next in thread: mfischer <email protected>: "[PHP-DEV] Bug #14545 Updated: DOM seems not to work"
- Reply: mfischer <email protected>: "[PHP-DEV] Bug #14545 Updated: DOM seems not to work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: alex <email protected>
Operating system: RedHat 7.1
PHP version: 4.1.0
PHP Bug Type: DOM XML related
Bug description: DOM seems not to work
the following code (taken from phpbuilder) works with php.4.0.6
with dom and fails with php 4.1.0
<?php
# make an example xml document to play with
$xmlstr = "<" . "?" . "xml version=\"1.0\"" . "?" . ">";
$xmlstr .=
"
<employee>
<name>Matt</name>
<position type=\"contract\">Web Guy</position>
</employee>
";
# load xml data ($doc becomes an instance of
# the DomDocument object)
$doc = xmldoc($xmlstr);
# get root node "employee"
$employee = $doc->root();
# get employee's children ("name","position")
$nodes = $employee->children();
# let's play with the "position" node
# so we must iterate through employee's
# children in search of it
while ($node = array_shift($nodes))
{
if ($node->name == "position")
{
$position = $node;
break;
}
}
# get position's type attribute
$type = $position->getattr("type");
# get the text enclosed by the position tag
# shift the first element off of position's children
$text_node = array_shift($position->children());
# access the content property of the text node
$text = $text_node->content;
# echo out the position and type
echo "position: $text<BR>";
echo "type: $type";
?>
-- Edit bug report at: http://bugs.php.net/?id=14545&edit=1-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: mfischer <email protected>: "[PHP-DEV] Bug #14545 Updated: DOM seems not to work"
- Previous message: yohgaki <email protected>: "[PHP-DEV] Bug #14224 Updated: fgets(), fgetc() stalls"
- Next in thread: mfischer <email protected>: "[PHP-DEV] Bug #14545 Updated: DOM seems not to work"
- Reply: mfischer <email protected>: "[PHP-DEV] Bug #14545 Updated: DOM seems not to work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

