note 53026 deleted from function.dom-domdocument-savexml by bjori

From: Date: Mon, 27 Mar 2006 00:30:42 +0000
Subject: note 53026 deleted from function.dom-domdocument-savexml by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106695@lists.php.net to get a copy of this message
Note Submitter: joe at fakeemail dot net ---- Say you want to put some XHTML inside an XML node and later extract it for output to the browser. For example: "<friend>Joanne <a href='joanne.com'>visit website</a></friend>" You need an innerXML function, similar to the Javascript innerHTML. It might look like this: function xt_innerXML(&$node){ if(!$node) return false; $document = $node->ownerDocument; $nodeAsString = $document->saveXML($node); preg_match('!\<.*?\>(.*)\</.*?\>!s',$nodeAsString,$match); return $match[1]; }

« previous php.notes (#106695) next »