[Tutor] finding mismatched or unpaired html tags

Dinesh B Vadhia dineshbvadhia at hotmail.com
Tue Apr 28 18:04:15 CEST 2009


Found the mismatched tag on line 94:

"<p>My Name in Nelma Lois Thornton-S.S. No. sjn-yz-yokv/p>"

should be:

"<p>My Name in Nelma Lois Thornton-S.S. No. sjn-yz-yokv</p>"

I'll run all the html files through a simple script to identify the mismatches using etree.  Thanks.

Dinesh



From: Kent Johnson 
Sent: Tuesday, April 28, 2009 8:17 AM
To: Dinesh B Vadhia 
Cc: tutor at python.org 
Subject: Re: [Tutor] finding mismatched or unpaired html tags


On Tue, Apr 28, 2009 at 10:41 AM, Dinesh B Vadhia
<dineshbvadhia at hotmail.com> wrote:
> This is the error and traceback:
>
> Unexpected error opening J:/F2/....html: mismatched tag: line 124, column 8
>
> Traceback (most recent call last):
>   File "C:\....py", line 492, in <module>
>     raw = extractText(xhtmlfile)
>   File "C:\....py", line 334, in extractText
>     tree = make_tree(xhtmlfile)
>   File "....py", line 169, in make_tree
>     return tree
> UnboundLocalError: local variable 'tree' referenced before assignment

This is inconsistent. The exception in the stack trace is from a
coding error in extractText. It looks like maybe ExtractText is
catching exceptions and printing them, and a bug in the exception
handling is causing the UnboundLocalError

> Here is line 124, col 8 and I cannot see any obvious missing/mismatched
> tags:
>
> "<p>As to the present time I am unable physical and mentally to secure all
> this information at present.</p>"

If you look at a few more lines do you see anything untoward? Perhaps
there is a missing </b> before the <p>, for example? I don't think <p>
is allowed inside every tag.

Kent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090428/790ed0b3/attachment.htm>


More information about the Tutor mailing list