TIDY Functions: Troubles with Get_Attr function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

	
I'm using the PHP 5.0.4 version with Apache 2 on Windows XP SP2 and
I've turned on the TIDY extension (php_tidy.dll) to parse HTML file
using PHP.

But using the function tidyNode->GET_ATTR() I received the following
error message:

"Fatal error: Call to undefined method tidyNode::get_attr() in
C:\Arquivos de programas\Apache
Group\Apache2\htdocs\teste\html\teste.php on line 22"

The 22 line in my code is the following one:
"$a_href = $child->get_attr (TIDY_ATTR_HREF);"

Below I'm attaching the whole source code of my test:
*************************************************
** teste.php code ****************************
*************************************************
<?
// Specify configuration
$config = array('indent'=> TRUE,
'indent-spaces' => 3,
'indent-cdata' => TRUE,
'output-xhtml' => TRUE,
'wrap' => 80);

// Tidy
$tidy = new tidy;
$tidy->parseFile("client_computer_options.htm", $config);
run_nodes($tidy->root(), 1);


function run_nodes($node, $indent) {

if($node->hasChildren()) {
foreach($node->child as $child) {
switch ($child->name)
{
case "a": {
$a_href = $child->get_attr (TIDY_ATTR_HREF);
$a_title = $child->get_attr (TIDY_ATTR_TITLE);
$a_text = $child->value;

$string = "<b>A -> HREF = </b>".$a_href." <b>| TITLE =
</b>".$a_title." <b>| TEXT = </b>".$a_text;
break;
}
default: {
$string = $child->name;
break;
}
}
echo str_repeat('.', $indent*2) . ($string ? $string :
'"'.$child->value.'"'). "<br>\n";

run_nodes($child, $indent+1);
}
}
}
?>
*************************************************

Could somebody help me on getting this code working? I really don't
know why the "undefined method" error is rising... Should it be a
incomplete tidy functions support at this PHP version?

Many Thanks,
Rick Jr.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux