note 30269 deleted from function.domnode-dump-node by sobak

From: Date: Tue, 22 Nov 2016 03:40:21 +0000
Subject: note 30269 deleted from function.domnode-dump-node by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207396@lists.php.net to get a copy of this message
Note Submitter: ---- The note above is exact : dump_node is not a method of the DomNode class anymore but a method of DomDocument class. Note that "$dom->dump_node($myNodeObject); " also works in PHP 4.2. So I recommand to use it like this. Last thing : you can't specified the encoding in the dump_node methode contrary to the dump_mem method. So characters like 'é' are always converted in UTF-8. The function below does exactly the same work as dump_node but also take in argument the encoding : (it's not elegant but it works) function my_dump_node($node,$encoding){ $domNode = domxml_new_doc("1.0"); $clonedNode = $node->clone_node(true); $domNode->append_child($clonedNode); $result = $domNode->dump_mem(true,$encoding); $pos = strpos($result,"?>"); return substr($result,$pos+2); } so $dom->dump_node($myNodeObject); becomes my_dump_node($myNodeObject,"ISO-8859-1");

« previous php.notes (#207396) next »