Re: DomNode->attributes() problem
[email protected] ("Arno Mittelbach") Tue, 22 Jun 2004 09:49:44 +0100
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
Hi,
you should maybe consider to upgrade to php5, since the dom implementation
totally changed.
Have a look at those two websites:
http://www.zend.com/php5/articles/php5-xmlphp.php
http://www.zend.com/manual/function.dom-domelement-getattribute.php
If you have to stick to php4, then try that:
class Toode{
function Toode(){
$szXML = join( '', file ('tooted.xml') );
if (! $oDom = domxml_open_mem( $szXML ) )
{
die ( 'damn! couldn\'t open the file.' );
}
$kaubad=$oDom->get_elements_by_tagname("kaup");
for($i=0; $i< count($kaubad); $i++)
{
$k=$kaubad[$i];
$nr=$k->get_attribute("nr");
echo "kauba id: ".$nr."<br>";
}
}
}
$test=new Toode();
Arno