note 46028 added to ref.dom
| From: | dn at NOSPAM dot xbe dot ch | Date: | Mon, 27 Sep 2004 13:31:11 +0000 |
| Subject: | note 46028 added to ref.dom | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77432@lists.php.net to get a copy of this message | ||
the w3c stuff seems to be a little bad-concepted..
- there seems to be no easy way get an array of all available attributes of a given node/element. i
didn't find it here nor in the w3c dom2 specification.
- the php documentation doesn't really cover ANY attributes which some objects have - and they
are really important.
example if you wish to get an element and simply print out its content (with some error checking):
<?php
$el = $xml->getElementsByTagName("tagname");
if(count($el)<1) {
return false;
}else{
foreach($el as $val) {
echo $val->firstChild->nodeValue;
}
}
?>
as you see, you have to go always through firstChild and it's attribute nodeValue to get the
desired value
as mentioned, the attributes of each object type should be documented as they're very
important. i would document them if i would know them....... ;)
----
Manual Page -- http://www.php.net/manual/en/ref.dom.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46028
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46028&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46028&report=yes
Search -- http://master.php.net/manage/user-notes.php