Cheers Guys,
Your the greatest !

On 8 Sep 2009, at 09:08, Peter Ford wrote:

Matthew Croud wrote:
Doesn't the DOM have the getAttribute() method?


It's not in my reference, though I see it in the PHP manual now.
This is what I have:


$dom = new DomDocument();
$dom -> load("items.xml");

$topics = $dom -> getElementsByTagName("item");

foreach ($topics as $node )
   echo("<li>". $node -> hasAttributes() ."</li>");


I'm replacing hasAttributes() with getAttribute() but its throwing me an
error, I'm probably using it incorrectly.
I think I'm drowning in the deep end =/
Could you advise Gamesmaster ?

It's a method on DomElement:

and you need to tell it which attribute to get... :)

Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

PHP General Mailing List (
To unsubscribe, visit:

Matthew Croud

Obvious Print Solutions Limited
Unit 3 Abbeygate Court
Stockett Lane
ME15 0PP

T | 0845 094 9704
F | 0845 094 9705

Reply via email to