"<!" in SGMLParser - an error ?
Amit Weisman
weismann at netvision.net.il
Fri Nov 9 17:25:48 EST 2001
I followed your "orders" and defined
def handle_comment(self , com) :
But after running the parser for few days , I encountered this error message
File "C:\PYTHON21\linksExtractor.py", line 29, in activateAndClear
self.feed(str)
File "C:\Python21\lib\sgmllib.py", line 91, in feed
self.goahead(0)
File "C:\Python21\lib\sgmllib.py", line 158, in goahead
k = self.parse_declaration(i)
File "C:\Python21\lib\sgmllib.py", line 238, in parse_declaration
raise SGMLParseError(
SGMLParseError: unexpected char in declaration: '<'
I can only guess The parser met a "< " and not a "<!" - But I don't know
enough to be sure .
What should I do to avoid it ?
What is it ?
Thanks
Amit
----- Original Message -----
From: "Fredrik Lundh" <fredrik at pythonware.com>
To: "Amit Weisman" <weismann at netvision.net.il>
Sent: Wednesday, November 07, 2001 10:36 AM
Subject: Re: "<!" in SGMLParser - an error ?
> (mailed; will be posted if/when the message gets
> through to my newsserver)
>
> hi amit,
>
> > I wasn't clear enougth .
>
> exactly my point ;-)
>
> > I know one should declare functions as
> > def do_TAGNAME
> > def start_TAGNAME
> > def end_TAGNAME
> >
> > How do I declare function for the "<!. ... " tag ?
>
> in addition the do/start/end methods, sgmllib lets you
> define general handlers for stuff like entities, comments,
> etc. to deal with things that start with "<!", you want
>
> def handle_comment(self, comment)
>
> or
>
> def handle_decl(self, data)
>
> (see the library reference for more info)
>
> </F>
>
>
More information about the Python-list
mailing list