<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/xmlwriter.examples.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), 'this' => array ( 0 => 'example.xmlwriter-oop.php', 1 => 'Working with the OO API', ), 'up' => array ( 0 => 'xmlwriter.examples.php', 1 => 'Esempi', ), 'prev' => array ( 0 => 'example.xmlwriter-namespace.php', 1 => 'Working with XML namespaces', ), 'next' => array ( 0 => 'class.xmlwriter.php', 1 => 'XMLWriter', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/xmlwriter/examples.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="example.xmlwriter-oop" class="section"> <h2 class="title">Working with the OO API</h2> <p class="para"> This example shows how to work with XMLWriter's object-oriented API. </p> <p class="para"> <div class="example" id="example-5556"> <p><strong>Example #1 Working with the OO API</strong></p> <div class="example-contents"> <div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br />$xw </span><span style="color: #007700">= new </span><span style="color: #0000BB">XMLWriter</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">openMemory</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">startDocument</span><span style="color: #007700">(</span><span style="color: #DD0000">"1.0"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">startElement</span><span style="color: #007700">(</span><span style="color: #DD0000">"book"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">text</span><span style="color: #007700">(</span><span style="color: #DD0000">"example"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">endElement</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">endDocument</span><span style="color: #007700">();<br />echo </span><span style="color: #0000BB">$xw</span><span style="color: #007700">-></span><span style="color: #0000BB">outputMemory</span><span style="color: #007700">();</span></span></code></div> </div> <div class="example-contents"><p>Il precedente esempio visualizzerĂ :</p></div> <div class="example-contents screen"> <div class="annotation-interactive cdata"><pre> <?xml version="1.0"?> <book>example</book> </pre></div> </div> </div> </p> </div><?php manual_footer($setup); ?>