Problem with XML_parser
| From: | Alex MacLeod | Date: | Thu, 08 Jul 2004 18:14:48 +0000 |
| Subject: | Problem with XML_parser | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13556@lists.php.net to get a copy of this message | ||
I see what you mean perhaps I should have posted the full code to begin with
instead of the first ten lines. Thanks though, heres the full code:
----------
<?php
require_once 'XML/Parser.php';
class myParser extends XML_Parser
{
function myParser()
{
parent::XML_Parser();
}
/**
* handle start element
*
* @access private
* @param resource xml parser resource
* @param string name of the element
* @param array attributes
*/
function startHandler($xp, $name, $attribs)
{
printf('handle start tag: %s<br />', $name);
}
/**
* handle start element
*
* @access private
* @param resource xml parser resource
* @param string name of the element
*/
function endHandler($xp, $name)
{
printf('handle end tag: %s<br />', $name);
}
}
$p = &new myParser();
$result = $p->setInputFile('tester.xml');
$result = $p->parse();
?>
-----------
On 8/7/04 6:24 pm, "Don Fitzsimmons" <dfitzsimmons@cox.net> wrote:
> Aren't you missing the closing bracket for the class?
>
> Don
> On Jul 8, 2004, at 10:23 AM, Alex MacLeod wrote:
>
>> Hi everyone,
>> This is my first time posting so excuse me if I miss any list
>> etiquette.
>>
>> I've just installed pear onto my Mac (OS 10.3.4) and really need to
>> use the
>> XML_parser package for a project I'm currently involved in.
>>
>> I have been reading the documentation and on the second page sadly
>> entitled
>> "Basic Example" I copy the example and save it locally then try to
>> test the
>> script. But I get the error:
>>
>> "Parse error: parse error, expecting
T_OLD_FUNCTION' or
>> T_FUNCTION'
>> or
>> T_VAR' or '}'' in
>> /Users/admin/Sites/downloaded
>> source/parse_using_pear.php on line 3"
>>
>>
>> So scratching my head I check whats going on on line 3 and find that
>> there
>> are no curly brackets yet???
>> Here are the first 10 lines of the code:
>> 1 <?php
>> 2 require_once 'XML/Parser.php';
>> 3
>> 4 class myParser extends XML_Parser
>> 5 {
>> 6 function myParser()
>> 7 {
>> 8 parent::XML_Parser();
>> 9 }
>> 10
>>
>>
>> As you can see, theres nothing there that should be throwing this error
>> up????
>> Or is there.
>> Thanks for any help you can offer
>> Alex
>>
>> --
>> PEAR General Mailing List (http://pear.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
------ End of Forwarded Message