Hi, I worked with MagicParser well until I wanted to use it from inside a class like this:
<?php
class ClassWithMagicParser
{
public $error;
...
function __construct ()
{
$format_string = ...;
...
}
function MethodWithMagicParser ()
{
...
$data = ...;
...
function myRecordHandler($item)
{
// return a non-zero value to stop reading any more records
return 1;
}
...
if(MagicParser_parse("string://".$data,"myRecordHandler",$this->format_string))
{
$this->error = MagicParser_getErrorMessage();
}
...
}
?>
I got no ErrorMessage and no result. The script simply stops.
Instead of "myRecordHandler"
in MagicParser_parse(...)
I tryed also $this->myRecordHandler
- no success.
May I use MagicParser from inside of a class?
Thanks, Hans-Martin
Thanks for fast answering!
I'll use SimpleXML instead of MagicParser in my class.
Hans-Martin Aurich
Internetservice
www.WebConsultant.de
Hello Hans-Martin,
Because Magic Parser uses a variable-function name callback and also makes use of its own global variables i'm afraid you won't be able to use it within a class. Apologies for any inconvenience.
Regards,
David.