Fwd:Suggested code fix for tidy

Terry Teague <[email protected]> Sat, 23 Jul 2005 23:44:02 -0700
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <l03130300bf08e8f5ac94@[17.219.130.37]>
Forwarded to the list.

>Date: Sat, 23 Jul 2005 16:18:31 -0700
>From: Bastien Duclaux <[email protected]>
>Subject: Suggested code fix for tidy
>Sender: Nobody <[email protected]>
>To: [email protected]
>Cc: [email protected]

>
>Message body follows:
>
>Hello Terry,
>
>I have found a problem with tidy, and I have a fix for it.
>
>Some sites which use XSL transformation to generate content
>have an incorrect <?xml version="1.0" encoding="...."?> tag
>inside the body of the HTML document, which makes tidy
>behave incorrectly.
>
>eg:
><html>
>        <head><title>Test Case</title></head>
>        <body>
>                <p>Bad!
>                <?xml version="1.0" encoding="utf-8"?>blablabla
>        </body>
></html>
>
>A simply suggested fix is to add the following code block
>inside ParseHead and ParseBody function at parser.c :
>
>(main loop)
>while ((node = GetToken(doc, mode)) != NULL)
>    {
>
>====> FIX
>if (node->type == XmlDecl)
>        {
>            ReportError(doc, &doc->root, node,
>DISCARDING_UNEXPECTED);
>            FreeNode(doc, node);
>            continue;
>        }
>====> END FIX
>
>I hope that you will be able to include this in the next
>version.
>
>Best regards,
>Bastien




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click