1--TEST-- 2DOMNode: hasAttributes() 3--CREDITS-- 4James Lewis <james@s-1.com> 5#TestFest 2008 6--SKIPIF-- 7<?php require_once('skipif.inc'); ?> 8--FILE-- 9<?php 10require_once("dom_test.inc"); 11 12$dom = new DOMDocument; 13$dom->loadXML($xmlstr); 14if(!$dom) { 15 echo "Error while parsing the document\n"; 16 exit; 17} 18 19$element = $dom->documentElement; 20 21echo "Verify that we have a DOMElement object:\n"; 22echo get_class($element), "\n"; 23 24echo "\nElement should have attributes:\n"; 25var_dump($element->hasAttributes()); 26 27$nodelist=$dom->getElementsByTagName('tbody') ; 28$element = $nodelist->item(0); 29 30echo "\nVerify that we have a DOMElement object:\n"; 31echo get_class($element), "\n"; 32 33echo "\nElement should have no attributes:\n"; 34var_dump($element->hasAttributes()); 35 36 37?> 38--EXPECTF-- 39Verify that we have a DOMElement object: 40DOMElement 41 42Element should have attributes: 43bool(true) 44 45Verify that we have a DOMElement object: 46DOMElement 47 48Element should have no attributes: 49bool(false) 50