<?php /** * Example that shows how to serialize an element to XML with a namespace * * $Id: example_api_toxml_ns.php 394 2007-06-17 20:04:18Z gerd $ * * @access public * @package patForms * @subpackage Examples * @author Sebastian Mordziol <argh@php-tools.net> * @license LGPL, see license.txt for details * @link http://www.php-tools.net */ /** * Main examples prepend file, needed *only* for the examples framework! */ include_once 'patExampleGen/prepend.php'; $exampleGen->displayHead( 'Example' ); // EXAMPLE START ------------------------------------------------------ /** * main patForms class */ require_once $neededFiles['patForms']; /** * patErrorManager class */ require_once $neededFiles['patErrorManager']; /** * localisation stuff */ require_once $neededFiles['patI18n_configure']; // attribute collection for the element $attributes = array( 'required' => 'yes', 'display' => 'yes', 'edit' => 'yes', 'label' => 'Username', 'description' => 'Enter your username here.', 'default' => 'Tom & Jerry', 'title' => 'Username', ); // create the element $el = patForms::createElement( 'toXML', 'String', $attributes ); // display the element echo $el->getAttribute( 'label' )."<br>"; echo "<div>".$el->serialize()."</div>"; echo "<i>".$el->getAttribute( 'description' )."</i><br><br>"; // serialize the element to xml with namespace $xml = $el->toXML( 'patForms' ); // display the xml (we use the example framwrok's XML hilighter for this) echo 'XML output:<br><br>'; $exampleGen->displayXMLString( $xml ); // EXAMPLE END ------------------------------------------------------ $exampleGen->displayFooter(); ?>