Example 5 - XML Document

View the example5.php

<?php

/**
 * Another example of how to build an
 * XML Document with the XML support
 * that phpHtmlLib provides.
 *
 * @author Walter A. Boring IV <waboring@newsblob.com>
 * @package phpHtmlLib
 * @subpackage examples
 * @version 2.0.0
 *
 */

/**
 * Include the phphtmllib libraries
 */
include_once("includes.inc");

//build the xml document object with a
//root xml tag of <example5>, and a <!DOCTYPE>
//link attribute of "some doctype link"
$xmldoc = new XMLDocument("example5""http://foo.com/DTDS/mail.dtd");

//add some tags to the root element
$xmldoc->addxml_tag("testing", array(), "foo",
                      
xml_tag("blah", array("value" => 1)) ) );

//build an array that represents
//xml tags and their values.
$arr = array("Foo" => array("bar" => "bleh",
                            
"bar" => array("testing" => "php")));
//add those tags from the array
$xmldoc->addarray_to_xml_tree$arr ) );

//this will render the entire page
print $xmldoc->render();
?>