* A simple script to clean and repair HTML,XHTML,PHP,ASP,etc. documents
* if no file is provided, it reads from standard input.
*
+ * NOTE: Works only with tidy for PHP 4.3.x, for tidy in PHP 5 see cleanhtml5.php
+ *
* By: John Coggeshall <john@php.net>
*
* Usage: php cleanhtml.php [filename]
--- /dev/null
+<?php
+
+ /*
+ * cleanhtml5.php
+ *
+ * A simple script to clean and repair HTML,XHTML,PHP,ASP,etc. documents
+ * if no file is provided, it reads from standard input.
+ *
+ * NOTE: Works only with tidy for PHP 5, for tidy in PHP 4.3.x see cleanhtml.php
+ *
+ * By: John Coggeshall <john@php.net>
+ *
+ * Usage: php cleanhtml5.php [filename]
+ *
+ */
+
+ if(!isset($_SERVER['argv'][1])) {
+ $data = file_get_contents("php://stdin");
+ $tidy = tidy_parse_string($data);
+ } else {
+ $tidy = tidy_parse_file($_SERVER['argv'][1]);
+ }
+
+ $tidy->clean_repair();
+
+ if(!empty($tidy->error_buf)) {
+
+ echo "\n\nThe following errors or warnings occured:\n";
+ echo "{$tidy->error_buf}\n";
+
+ }
+
+ echo $tidy;
+
+?>
+
+
+
+
\ No newline at end of file
--- /dev/null
+<?php
+ /*
+ * dumpit5.php
+ *
+ * a command-line script which dumps the given HTML, PHP, ASP, XHTML, etc.
+ * file as it is represented in the document model.
+ *
+ * NOTE: Only works with tidy for PHP 5+, for tidy in 4.3.x, see dumpit.php
+ *
+ * By: John Coggeshall <john@php.net>
+ *
+ * Usage; php dumpit5.php <filename>
+ */
+
+ $tidy = tidy_parse_file($_SERVER['argv'][1]);
+
+ /* Optionally you can do this here if you want to fix up the document */
+
+ /* $tidy->clean_repair() */
+
+ $tree = $tidy->root();
+ dump_tree($tree);
+ echo "\n";
+
+ function node_type($type) {
+
+ switch($type) {
+
+ case TIDY_NODETYPE_ROOT: return "Root Node";
+ case TIDY_NODETYPE_DOCTYPE: return "DocType Node";
+ case TIDY_NODETYPE_COMMENT: return "Comment Node";
+ case TIDY_NODETYPE_PROCINS: return "ProcIns Node";
+ case TIDY_NODETYPE_TEXT: return "Text Node";
+ case TIDY_NODETYPE_START: return "Start Node";
+ case TIDY_NODETYPE_END: return "End Node";
+ case TIDY_NODETYPE_STARTEND: return "Start/End Node";
+ case TIDY_NODETYPE_CDATA: return "CDATA Node";
+ case TIDY_NODETYPE_SECTION: return "Section Node";
+ case TIDY_NODETYPE_ASP: return "ASP Source Code Node";
+ case TIDY_NODETYPE_PHP: return "PHP Source Code Node";
+ case TIDY_NODETYPE_JSTE: return "JSTE Source Code";
+ case TIDY_NODETYPE_XMLDECL: return "XML Declaration Node";
+ default: return "Unknown Node";
+ }
+ }
+
+ function do_leaf($string, $indent) {
+ for($i = 0; $i < $indent; $i++) {
+ echo " ";
+ }
+ echo $string;
+ }
+
+ function dump_tree(tidy_node $node, $indent = 0) {
+
+ /* Put something there if the node name is empty */
+ $nodename = trim(strtoupper($node->name));
+ $nodename = (empty($nodename)) ? "[EMPTY]" : $nodename;
+
+ /* Generate the Node, and a pretty name for it */
+ do_leaf(" + $nodename (".node_type($node->type).")\n", $indent);
+
+ /* Check to see if this node is a text node. Text nodes are
+ generated by start/end tags and contain the text in between.
+ i.e. <B>foo</B> will create a text node with $node->value
+ equal to 'foo' */
+ if($node->type == TIDY_NODETYPE_TEXT) {
+ do_leaf(" |\n", $indent);
+ do_leaf(" +---- Value: '{$node->value}'\n", $indent);
+ }
+
+ if(count($node->attribute)) {
+ do_leaf(" |\n", $indent);
+ do_leaf(" +---- Attributes\n", $indent);
+
+ foreach($node->attribute as $name=>$value) {
+ @do_leaf(" +-- $name\n", $indent);
+ do_leaf(" | +-- Value: $value\n", $indent);
+ }
+ }
+
+ /* Recurse along the children to generate the remaining nodes */
+ if($node->has_children()) {
+ foreach($node->child as $child) {
+ dump_tree($child, $indent + 3);
+ }
+ }
+
+ }
+
+
+?>
\ No newline at end of file
* A simple command-line utility to extract all of the URLS contained
* within <A HREF> tags from a document.
*
+ * NOTE: Only works with tidy for PHP 4.3.x, please see urlgrab5.php for tidy for PHP 5
+ *
* By: John Coggeshall <john@php.net>
*
* Usage: php urlgrab.php <file>
--- /dev/null
+<?php
+ /*
+ * urlgrab5.php
+ *
+ * A simple command-line utility to extract all of the URLS contained
+ * within <A HREF> tags from a document.
+ *
+ * NOTE: Only works with tidy for PHP 5, please see urlgrab.php for tidy for PHP 4.3.x
+ *
+ * By: John Coggeshall <john@php.net>
+ *
+ * Usage: php urlgrab5.php <file>
+ *
+ */
+ function dump_nodes(tidy_node $node, &$urls = NULL) {
+
+ $urls = (is_array($urls)) ? $urls : array();
+
+ if(isset($node->id)) {
+ if($node->id == TIDY_TAG_A) {
+ $urls[] = $node->attribute['href'];
+ }
+ }
+
+ if($node->has_children()) {
+
+ foreach($node->child as $c) {
+
+ dump_nodes($c, $urls);
+
+ }
+
+ }
+
+ return $urls;
+ }
+
+ $a = tidy_parse_file($_SERVER['argv'][1]);
+ $a->clean_repair();
+ print_r(dump_nodes($a->html()));
+?>
\ No newline at end of file
$a->setopt("tab-size", 10);
echo "\nNew Value of 'tab-size': ";
var_dump($a->getopt("tab-size"));
+ tidy_setopt($a, "tab-size", 12);
+ echo "\nNew Value of 'tab-size': ";
+ var_dump(tidy_getopt($a, "tab-size"));
} else {
echo "Current Value of 'tidy-mark': ";
var_dump(tidy_getopt("tidy-mark"));
Current Value of 'tab-size': int(8)
New Value of 'tab-size': int(10)
+
+New Value of 'tab-size': int(12)
--- /dev/null
+--TEST--
+Accessing the error buffer via $obj->error_buf...
+--SKIPIF--
+<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+--POST--
+--GET--
+--INI--
+--FILE--
+<?php
+ $a = tidy_parse_string("<HTML><asd asdf></HTML>");
+ echo $a->error_buf;
+
+?>
+--EXPECT--
+line 1 column 1 - Warning: missing <!DOCTYPE> declaration
+line 1 column 7 - Error: <asd> is not recognized!
+line 1 column 7 - Warning: discarding unexpected <asd>
+line 1 column 17 - Warning: discarding unexpected </html>
+line 1 column 7 - Warning: inserting missing 'title' element
\ No newline at end of file
--- /dev/null
+--TEST--
+tidy_doc object overloading
+--SKIPIF--
+<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+--POST--
+--GET--
+--INI--
+--FILE--
+<?php
+ $a = tidy_parse_string("<HTML></HTML>");
+ echo $a;
+
+?>
+--EXPECT--
+<html>
+<head>
+<title></title>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+--TEST--
+Accessing root, body, html, and head nodes..
+--SKIPIF--
+<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+--POST--
+--GET--
+--INI--
+--FILE--
+<?php
+ $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>");
+ var_dump($a->root());
+ var_dump($a->body());
+ var_dump($a->html());
+ var_dump($a->head());
+
+?>
+--EXPECT--
+object(tidy_node)#2 (5) {
+ ["value"]=>
+ string(94) "<html>
+<head>
+<title></title>
+</head>
+<body bgcolor="#FFFFFF" alink="#000000">
+</body>
+</html>"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(0)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#3 (6) {
+ ["value"]=>
+ string(94) "<html>
+<head>
+<title></title>
+</head>
+<body bgcolor="#FFFFFF" alink="#000000">
+</body>
+</html>"
+ ["name"]=>
+ string(4) "html"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(48)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(31) "<head>
+<title></title>
+</head>
+"
+ ["name"]=>
+ string(4) "head"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(46)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#5 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ [1]=>
+ &object(tidy_node)#6 (6) {
+ ["value"]=>
+ string(49) "<body bgcolor="#FFFFFF" alink="#000000">
+</body>
+"
+ ["name"]=>
+ string(4) "body"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(16)
+ ["attribute"]=>
+ array(2) {
+ ["bgcolor"]=>
+ string(7) "#FFFFFF"
+ ["alink"]=>
+ string(7) "#000000"
+ }
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ }
+}
+object(tidy_node)#2 (6) {
+ ["value"]=>
+ string(49) "<body bgcolor="#FFFFFF" alink="#000000">
+</body>
+"
+ ["name"]=>
+ string(4) "body"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(16)
+ ["attribute"]=>
+ array(2) {
+ ["bgcolor"]=>
+ string(7) "#FFFFFF"
+ ["alink"]=>
+ string(7) "#000000"
+ }
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#2 (6) {
+ ["value"]=>
+ string(94) "<html>
+<head>
+<title></title>
+</head>
+<body bgcolor="#FFFFFF" alink="#000000">
+</body>
+</html>"
+ ["name"]=>
+ string(4) "html"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(48)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#3 (6) {
+ ["value"]=>
+ string(31) "<head>
+<title></title>
+</head>
+"
+ ["name"]=>
+ string(4) "head"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(46)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#6 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ [1]=>
+ &object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(49) "<body bgcolor="#FFFFFF" alink="#000000">
+</body>
+"
+ ["name"]=>
+ string(4) "body"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(16)
+ ["attribute"]=>
+ array(2) {
+ ["bgcolor"]=>
+ string(7) "#FFFFFF"
+ ["alink"]=>
+ string(7) "#000000"
+ }
+ ["child"]=>
+ NULL
+ }
+ }
+}
+object(tidy_node)#2 (6) {
+ ["value"]=>
+ string(31) "<head>
+<title></title>
+</head>
+"
+ ["name"]=>
+ string(4) "head"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(46)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
--- /dev/null
+--TEST--
+Accessing attributes of a node
+--SKIPIF--
+<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+--POST--
+--GET--
+--INI--
+--FILE--
+<?php
+ $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>");
+ $body = $a->body();
+ var_dump($body->attribute);
+ foreach($body->attribute as $key=>$val) {
+ echo "Attrib '$key': $val\n";
+ }
+?>
+--EXPECT--
+array(2) {
+ ["bgcolor"]=>
+ string(7) "#FFFFFF"
+ ["alink"]=>
+ string(7) "#000000"
+}
+Attrib 'bgcolor': #FFFFFF
+Attrib 'alink': #000000
\ No newline at end of file
--- /dev/null
+--TEST--
+Accessing children nodes
+--SKIPIF--
+<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+--POST--
+--GET--
+--INI--
+--FILE--
+<?php
+
+ function dump_nodes(tidy_node $node) {
+
+ var_dump($node->has_children());
+ if($node->has_children()) {
+
+ foreach($node->child as $c) {
+
+ var_dump($c);
+
+ if($c->has_children()) {
+
+ dump_nodes($c);
+
+ }
+ }
+
+ }
+
+ }
+
+ $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>");
+ $html = $a->html();
+ dump_nodes($html);
+
+?>
+--EXPECT--
+bool(true)
+object(tidy_node)#3 (6) {
+ ["value"]=>
+ string(31) "<head>
+<title></title>
+</head>
+"
+ ["name"]=>
+ string(4) "head"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(46)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
+bool(true)
+object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#5 (6) {
+ ["value"]=>
+ string(80) "<body bgcolor="#FFFFFF" alink="#000000">
+<b>Hi</b><i>Bye<u>Test</u></i>
+</body>
+"
+ ["name"]=>
+ string(4) "body"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(16)
+ ["attribute"]=>
+ array(2) {
+ ["bgcolor"]=>
+ string(7) "#FFFFFF"
+ ["alink"]=>
+ string(7) "#000000"
+ }
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#6 (6) {
+ ["value"]=>
+ string(9) "<b>Hi</b>"
+ ["name"]=>
+ string(1) "b"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(8)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#7 (5) {
+ ["value"]=>
+ string(2) "Hi"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ [1]=>
+ &object(tidy_node)#8 (6) {
+ ["value"]=>
+ string(21) "<i>Bye<u>Test</u></i>"
+ ["name"]=>
+ string(1) "i"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(49)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#9 (5) {
+ ["value"]=>
+ string(3) "Bye"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ [1]=>
+ &object(tidy_node)#10 (6) {
+ ["value"]=>
+ string(11) "<u>Test</u>"
+ ["name"]=>
+ string(1) "u"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(114)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ }
+ }
+ }
+}
+bool(true)
+object(tidy_node)#6 (6) {
+ ["value"]=>
+ string(9) "<b>Hi</b>"
+ ["name"]=>
+ string(1) "b"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(8)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#7 (5) {
+ ["value"]=>
+ string(2) "Hi"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
+bool(true)
+object(tidy_node)#7 (5) {
+ ["value"]=>
+ string(2) "Hi"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#8 (6) {
+ ["value"]=>
+ string(21) "<i>Bye<u>Test</u></i>"
+ ["name"]=>
+ string(1) "i"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(49)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#9 (5) {
+ ["value"]=>
+ string(3) "Bye"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ [1]=>
+ &object(tidy_node)#10 (6) {
+ ["value"]=>
+ string(11) "<u>Test</u>"
+ ["name"]=>
+ string(1) "u"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(114)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ }
+}
+bool(true)
+object(tidy_node)#9 (5) {
+ ["value"]=>
+ string(3) "Bye"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#10 (6) {
+ ["value"]=>
+ string(11) "<u>Test</u>"
+ ["name"]=>
+ string(1) "u"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(114)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
+bool(true)
+object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
--- /dev/null
+--TEST--
+Accessing children nodes
+--SKIPIF--
+<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
+--POST--
+--GET--
+--INI--
+--FILE--
+<?php
+
+ function dump_nodes(tidy_node $node) {
+
+ var_dump($node->has_children());
+ if($node->has_children()) {
+
+ foreach($node->child as $c) {
+
+ var_dump($c);
+
+ if($c->has_children()) {
+
+ dump_nodes($c);
+
+ }
+ }
+
+ }
+
+ }
+
+ $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>");
+ $html = $a->html();
+ dump_nodes($html);
+
+?>
+--EXPECT--
+bool(true)
+object(tidy_node)#3 (6) {
+ ["value"]=>
+ string(31) "<head>
+<title></title>
+</head>
+"
+ ["name"]=>
+ string(4) "head"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(46)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
+bool(true)
+object(tidy_node)#4 (6) {
+ ["value"]=>
+ string(16) "<title></title>
+"
+ ["name"]=>
+ string(5) "title"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(111)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#5 (6) {
+ ["value"]=>
+ string(80) "<body bgcolor="#FFFFFF" alink="#000000">
+<b>Hi</b><i>Bye<u>Test</u></i>
+</body>
+"
+ ["name"]=>
+ string(4) "body"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(16)
+ ["attribute"]=>
+ array(2) {
+ ["bgcolor"]=>
+ string(7) "#FFFFFF"
+ ["alink"]=>
+ string(7) "#000000"
+ }
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#6 (6) {
+ ["value"]=>
+ string(9) "<b>Hi</b>"
+ ["name"]=>
+ string(1) "b"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(8)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#7 (5) {
+ ["value"]=>
+ string(2) "Hi"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ [1]=>
+ &object(tidy_node)#8 (6) {
+ ["value"]=>
+ string(21) "<i>Bye<u>Test</u></i>"
+ ["name"]=>
+ string(1) "i"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(49)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#9 (5) {
+ ["value"]=>
+ string(3) "Bye"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ [1]=>
+ &object(tidy_node)#10 (6) {
+ ["value"]=>
+ string(11) "<u>Test</u>"
+ ["name"]=>
+ string(1) "u"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(114)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ }
+ }
+ }
+}
+bool(true)
+object(tidy_node)#6 (6) {
+ ["value"]=>
+ string(9) "<b>Hi</b>"
+ ["name"]=>
+ string(1) "b"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(8)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#7 (5) {
+ ["value"]=>
+ string(2) "Hi"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
+bool(true)
+object(tidy_node)#7 (5) {
+ ["value"]=>
+ string(2) "Hi"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#8 (6) {
+ ["value"]=>
+ string(21) "<i>Bye<u>Test</u></i>"
+ ["name"]=>
+ string(1) "i"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(49)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(2) {
+ [0]=>
+ &object(tidy_node)#9 (5) {
+ ["value"]=>
+ string(3) "Bye"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ [1]=>
+ &object(tidy_node)#10 (6) {
+ ["value"]=>
+ string(11) "<u>Test</u>"
+ ["name"]=>
+ string(1) "u"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(114)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+ }
+ }
+}
+bool(true)
+object(tidy_node)#9 (5) {
+ ["value"]=>
+ string(3) "Bye"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}
+object(tidy_node)#10 (6) {
+ ["value"]=>
+ string(11) "<u>Test</u>"
+ ["name"]=>
+ string(1) "u"
+ ["type"]=>
+ int(5)
+ ["id"]=>
+ int(114)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ array(1) {
+ [0]=>
+ &object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+ }
+ }
+}
+bool(true)
+object(tidy_node)#11 (5) {
+ ["value"]=>
+ string(4) "Test"
+ ["name"]=>
+ string(0) ""
+ ["type"]=>
+ int(4)
+ ["attribute"]=>
+ NULL
+ ["child"]=>
+ NULL
+}