<?php
/**
* You can test this example with the not-indented class, by removing the comments from
* "include('htmlElement.inc')", and commenting "include('indent/htmlElement.inc')" to
* avoid conflicts.
*/
#include('htmlElement.inc');
include('indented/htmlElement.inc'); //indented class
/**
* HTML example
*/
$div = new HTMLElement('div');
$div->appendText('TextNode test');
$div->setAttribute('id','divid1');
$div->setAttribute('name','divname1');
$div2 = new HTMLElement('div');
$div2->setAttribute('id','divid2');
$div2->setAttribute('name','divname2');
$div3 = new HTMLElement('div');
$div3->setAttribute('id','divid3');
$div3->setAttribute('name','divname3');
$div->appendChild($div2);
$div2->appendChild($div3);
#print_r($div);
echo $div->toHTML();
echo "\n\n";
/**
* XML example
*/
$div = new HTMLElement('xml-doc');
$div2 = new HTMLElement('div');
$div2->setAttribute('id','divid2');
$div2->setAttribute('name','divname2');
$div3 = new HTMLElement('div');
$div3->setAttribute('id','divid3');
$div3->setAttribute('name','divname3');
$div->appendChild($div2);
$div->appendChild($div3);
#print_r($div);
echo $div->toXML();
?>
|