Re: DomNode->attributes() problem
| From: | Arno Mittelbach | Date: | Tue, 22 Jun 2004 08:49:44 +0000 |
| Subject: | Re: DomNode->attributes() problem | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-394@lists.php.net to get a copy of this message | ||
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