[XML-SIG] Bug in sgmlop?

Walter Dörwald walter@bnbt.de
Sun, 28 May 2000 19:52:03 +0200


At 16:13 28.05.00, you wrote:
>Walter Dörwald wrote:
> > parser.register(handler())
> > parser.parse("gurk")
> > parser.close()
>
>footnote: the correct way to use the parser is to
>either call "feed" a couple of time, and call "close"
>when you don't have more data, or to call "parse"
>just once, with all the data you have.

Thanks for the tips, I'm doing a feed/close loop
    self.lineno = 1
    for line in lines:
       parser.feed(line)
       self.lineno = self.lineno + 1
    parser.close()
but only because I need line number information so
I'm splitting the source into lines. I suppose
parsing the string in one go would be faster.

Are there any plans to provide line and column
number information to the sgmlop user?
E.g. the function
         finish_starttag(self,name,attrs)
could be changed to
         finish_starttag(self,name,attrs,row,col)
and should be passed the position in the string
where the tag started. (and similar for the other
functions). This would greatly simplify finding
"bugs" in an XML file and could be used by a
XML editor to highlight the position of the error.

Bye,
         Walter Dörwald





>not that it matters much in the current release...
>
></F>
>
>
>_______________________________________________
>XML-SIG maillist  -  XML-SIG@python.org
>http://www.python.org/mailman/listinfo/xml-sig