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); ?>

Working with the OO API

This example shows how to work with XMLWriter's object-oriented API.

Example #1 Working with the OO API

<?php

$xw
= new XMLWriter();
$xw->openMemory();
$xw->startDocument("1.0");
$xw->startElement("book");
$xw->text("example");
$xw->endElement();
$xw->endDocument();
echo
$xw->outputMemory();

Il precedente esempio visualizzerĂ :

<?xml version="1.0"?>
<book>example</book>