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.3 2003/02/27 22:07:57 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 |
include_once($phphtmllib."/widgets/xml/XMLDocumentClass.inc"); |
23 |
|
24 |
//build the xml document object with a |
25 |
//root xml tag of <example5>, and a <!DOCTYPE> |
26 |
//link attribute of "some doctype link" |
27 |
$xmldoc = new XMLDocumentClass("example5", "http://foo.com/DTDS/mail.dtd"); |
28 |
|
29 |
//make sure we have the XMLDocumentClass automatically |
30 |
//output the correct http Content-Type value |
31 |
$xmldoc->show_http_header(); |
32 |
|
33 |
//add some tags to the root element |
34 |
$xmldoc->add( xml_tag("testing", array(), "foo", |
35 |
xml_tag("blah", array("value" => 1)) ) ); |
36 |
|
37 |
//build an array that represents |
38 |
//xml tags and their values. |
39 |
$arr = array("Foo" => array("bar" => "bleh", |
40 |
"bar" => array("testing" => "php"))); |
41 |
//add those tags from the array |
42 |
$xmldoc->add( array_to_xml_tree( $arr ) ); |
43 |
|
44 |
//this will render the entire page |
45 |
print $xmldoc->render(); |
46 |
?> |