[XML-SIG] HtmlBuilder
Jeff.Johnson@icn.siemens.com
Jeff.Johnson@icn.siemens.com
Mon, 8 Mar 1999 12:24:27 -0500
Oops, thanks for finding the overhead. I figured someone could have
optimized it somehow but I should have caught that at least :)
I like the idea of allowing the user to toggle raising exceptions or
ignoring the error.
Thanks again,
Jeff
"Fred L. Drake" <fdrake@cnri.reston.va.us> on 03/05/99 06:06:25 PM
Please respond to "Fred L. Drake, Jr." <fdrake@acm.org>
To: Jeff Johnson/Service/ICN
cc: xml-sig@python.org
Subject: Re: [XML-SIG] HtmlBuilder
Jeff.Johnson@icn.siemens.com writes:
> it. I did however add two lines of code to HtmlBuilder that will allow
> these bogus end tags to be ignored. I hope that the new code can be
added
Jeff,
I think this would be fine. Perhaps a parameter to the constructor,
or just an instance variable, could be used to determine whether an
exception is raised or the problem silently ignored.
> def unknown_endtag(self, tag):
> tag = string.upper(tag)
> #print 'ending', tag
>
> while self.stack:
> if tag not in self.stack:
> #print "ignoring end tag with no start",
> tag
> break
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The whole bit that you added could be moved before the while loop;
that would avoid the extra overhead without loss of functionality.
-Fred
--
Fred L. Drake, Jr. <fdrake@acm.org>
Corporation for National Research Initiatives
1895 Preston White Dr. Reston, VA 20191