| 1 | <?php | 
| 2 |  | 
| 3 | /** | 
| 4 | * Another example of how to build an | 
| 5 | * XML Document with the XML support | 
| 6 | * that phpHtmlLib provides. | 
| 7 | * | 
| 8 | * | 
| 9 | * $Id: example5.php,v 1.2 2002/11/08 22:37:05 hemna Exp $ | 
| 10 | * | 
| 11 | * @author Walter A. Boring IV <waboring@buildabetterweb.com> | 
| 12 | * @package phpHtmlLib | 
| 13 | * @subpackage examples | 
| 14 | * @version 2.0.0 | 
| 15 | * | 
| 16 | */ | 
| 17 |  | 
| 18 | /** | 
| 19 | * Include the phphtmllib libraries | 
| 20 | */ | 
| 21 | include_once("includes.inc"); | 
| 22 |  | 
| 23 | //build the xml document object with a | 
| 24 | //root xml tag of <example5>, and a <!DOCTYPE> | 
| 25 | //link attribute of "some doctype link" | 
| 26 | $xmldoc = new XMLDocumentClass("example5", "http://foo.com/DTDS/mail.dtd"); | 
| 27 |  | 
| 28 | //make sure we have the XMLDocumentClass automatically | 
| 29 | //output the correct http Content-Type value | 
| 30 | $xmldoc->show_http_header(); | 
| 31 |  | 
| 32 | //add some tags to the root element | 
| 33 | $xmldoc->add( xml_tag("testing", array(), "foo", | 
| 34 | xml_tag("blah", array("value" => 1)) ) ); | 
| 35 |  | 
| 36 | //build an array that represents | 
| 37 | //xml tags and their values. | 
| 38 | $arr = array("Foo" => array("bar" => "bleh", | 
| 39 | "bar" => array("testing" => "php"))); | 
| 40 | //add those tags from the array | 
| 41 | $xmldoc->add( array_to_xml_tree( $arr ) ); | 
| 42 |  | 
| 43 | //this will render the entire page | 
| 44 | print $xmldoc->render(); | 
| 45 | ?> |