note 87893 added to domdocument.importnode

From: Date: Mon, 29 Dec 2008 11:43:13 +0000
Subject: note 87893 added to domdocument.importnode
Groups: php.notes 
Request: Send a blank email to php-notes+get-148638@lists.php.net to get a copy of this message
When you use function/method below, php automaticaly inserts namespaces (if you have some). If you want to join xml files exactly, then you can just use placeholders and treat xml as a string. <?php function joinXMLStrings($file1, $file2) { //remove xml declaration $file2 = trim(preg_replace('/<\?xml.*\?>/', '', $file2, 1)); //insert file2 in the place of placeholder in the first file $file1 = trim(preg_replace('/<\?file2\s\?>/', $file2, $file1, 1)); } ?> so function looks like this and you insert two xml files. First file has to have placeholder (where you insert file2). Placeholder in this case will be <?file2 ?> !!!this is only for ilustration - test before you use it ---- Server IP: 92.48.74.199 Probable Submitter: 217.158.106.15 ---- Manual Page -- http://www.php.net/manual/en/domdocument.importnode.php Edit -- https://master.php.net/note/edit/87893 Del: integrated -- https://master.php.net/note/delete/87893/integrated Del: useless -- https://master.php.net/note/delete/87893/useless Del: bad code -- https://master.php.net/note/delete/87893/bad+code Del: spam -- https://master.php.net/note/delete/87893/spam Del: non-english -- https://master.php.net/note/delete/87893/non-english Del: in docs -- https://master.php.net/note/delete/87893/in+docs Del: other reasons-- https://master.php.net/note/delete/87893 Reject -- https://master.php.net/note/reject/87893 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#148638) next »