note 88686 added to domdocument.createprocessinginstruction

From: Date: Tue, 03 Feb 2009 19:57:30 +0000
Subject: note 88686 added to domdocument.createprocessinginstruction
Groups: php.notes 
Request: Send a blank email to php-notes+get-150164@lists.php.net to get a copy of this message
A use exemple of this method : Usefull for generating an XML linked with a XSLT ! <?php // "Create" the document. $xml = new DOMDocument( "1.0", "ISO-8859-15" ); //to have indented output, not just a line $xml->preserveWhiteSpace = false; $xml->formatOutput = true; // ------------- Interresting part here ------------ //creating an xslt adding processing line $xslt = $xml->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="base.xsl"'); //adding it to the xml $xml->appendChild($xslt); // ----------- / Interresting part here ------------- //adding some elements $root = $xml->createElement("list"); $node = $xml->createElement("contact", "John Doe"); $root-> appendChild($node); $xml-> appendChild($root); //creating the file $xml-> save("output.xml"); ?> output.xml : <?xml version="1.0" encoding="ISO-8859-15"?> <?xml-stylesheet type="text/xsl" href="base.xsl"?> //the line has been created successfully <list> <contact>John Doe</contact> </list> ---- Server IP: 69.147.83.197 Probable Submitter: 83.205.82.177 ---- Manual Page -- http://www.php.net/manual/en/domdocument.createprocessinginstruction.php Edit -- https://master.php.net/note/edit/88686 Del: integrated -- https://master.php.net/note/delete/88686/integrated Del: useless -- https://master.php.net/note/delete/88686/useless Del: bad code -- https://master.php.net/note/delete/88686/bad+code Del: spam -- https://master.php.net/note/delete/88686/spam Del: non-english -- https://master.php.net/note/delete/88686/non-english Del: in docs -- https://master.php.net/note/delete/88686/in+docs Del: other reasons-- https://master.php.net/note/delete/88686 Reject -- https://master.php.net/note/reject/88686 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150164) next »