note 109584 added to domdocument.savexml

From: Date: Tue, 31 Jul 2012 02:30:11 +0000
Subject: note 109584 added to domdocument.savexml
Groups: php.notes 
Request: Send a blank email to php-notes+get-189521@lists.php.net to get a copy of this message
There are no best way to display the complete contens in an xml file in general (tags included). Here are three ways for you to try out. Which one do you prefere? By Richard Holm, Sweden. <?php $domdoc=new DOMDocument(); $domdoc->load('articles.xml'); $xmldoc=$domdoc->saveXML(); echo "Using htmlentities()<br/>"; echo '<b style="font-family:monospace">'.htmlentities($xmldoc).'</b>'; echo "<br/><br/>Using strtr()<br/>"; $tr=array('<'=>'&lt;','>'=>'&gt;',' '=>'&nbsp;',"\n"=>'<br/>'); echo '<b style="font-family:monospace">'.strtr($xmldoc,$tr).'</b>'; echo "<br/><br/>Using xmp-tag"; echo '<b style="font-family:monospace"><xmp>'.$xmldoc.'</xmp></b>'; ?> Note: xmp-tag is deprecated (no support). However, some browsers still support it. My favorites are: Mozilla, Chrome and none Microsoft products. ---- Server IP: 212.63.222.76 Probable Submitter: 90.228.192.205 ---- Manual Page -- http://www.php.net/manual/en/domdocument.savexml.php Edit -- https://master.php.net/note/edit/109584 Del: integrated -- https://master.php.net/note/delete/109584/integrated Del: useless -- https://master.php.net/note/delete/109584/useless Del: bad code -- https://master.php.net/note/delete/109584/bad+code Del: spam -- https://master.php.net/note/delete/109584/spam Del: non-english -- https://master.php.net/note/delete/109584/non-english Del: in docs -- https://master.php.net/note/delete/109584/in+docs Del: other reasons-- https://master.php.net/note/delete/109584 Reject -- https://master.php.net/note/reject/109584 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189521) next »