note 76818 added to function.dom-domelement-setattribute

From: Date: Tue, 31 Jul 2007 23:44:40 +0000
Subject: note 76818 added to function.dom-domelement-setattribute
Groups: php.notes 
Request: Send a blank email to php-notes+get-129089@lists.php.net to get a copy of this message
@karvjorm, Using this method is not exactly a good practice. Infact, I think it may be a bug. Names beginning with "xml" are reserved (for namespaces in this case). setAttribute() should return false in this case I think, but I suppose it doesn't. Still, the right way to do it is with createElementNS(). It lets you specify the namespace when creating the element node. So the equivalent to yours ($html added to allow word wrapping) is: $dom = new DomDocument('1.0','iso-8859-15'); $html = $dom->createElementNS('http://www.w3.org/1999/xhtml', 'html'); $ht_ml = $dom->appendChild($html); $ht_ml->setAttribute('xml:lang','fi'); $ht_ml->setAttribute('lang','fi'); ---- Server IP: 195.149.248.161 Probable Submitter: 83.148.87.92 ---- Manual Page -- http://www.php.net/manual/en/function.dom-domelement-setattribute.php Edit -- https://master.php.net/note/edit/76818 Del: integrated -- https://master.php.net/note/delete/76818/integrated Del: useless -- https://master.php.net/note/delete/76818/useless Del: bad code -- https://master.php.net/note/delete/76818/bad+code Del: spam -- https://master.php.net/note/delete/76818/spam Del: non-english -- https://master.php.net/note/delete/76818/non-english Del: in docs -- https://master.php.net/note/delete/76818/in+docs Del: other reasons-- https://master.php.net/note/delete/76818 Reject -- https://master.php.net/note/reject/76818 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129089) next »