Mon, 8 Mar 1999 13:08:10 -0500
Another problem I often see in hand-made HTML files is improperly nested
tags. I wonder if there is a clean way to detect those errors?
<b><i>Bold italic text with end tags in wrong order.</b></i>
Actually, I guess the ignore_mismatched_end_tags will fix this specific
error. When the </b> tag is read it will pop off the open <i> tag as it
always did, then the </i> tag will be ignored with the new fix. Never mind
Thanks for adding this to the CVS tree! I've already told my HTML hacker
friends that I can now work with and fix their buggy web pages for them. A
few months back I swore to them that Python XML was the greatest tool I
knew of to change their banner code but then I couldn't read half of the
files due to bad end tags.
"Andrew M. Kuchling" <firstname.lastname@example.org> on 03/08/99 12:31:03 PM
cc: (bcc: Jeff Johnson/Service/ICN)
Subject: Re: [XML-SIG] HtmlBuilder
[on ignoring bogus end tags]
>I like the idea of allowing the user to toggle raising exceptions or
>ignoring the error.
Indeed. Here's a proposal for the interface:
b = HTMLBuilder( ignore_mismatched_end_tags = 1 )
(This would be implemented by allowing keyword arguments to
the constructor, and saving a copy of the keyword dictionary. That
allows for new options in future, and saves the constructor from
having lots of lines like
self.ignore_mismatched_end_tags = ignore_mismatched_end_tags .)
The default behaviour would be to raise an exception, which is
in keeping with Python's general philosophy.
A.M. Kuchling http://starship.python.net/crew/amk/
Athens built the Acropolis. Corinth was a commercial city, interested in
purely materialistic things. Today we admire Athens, visit it, preserve the
old temples, yet we hardly ever set foot in Corinth.
-- Harold Urey
XML-SIG maillist - XML-SIG@python.org