Re: How to get a 'good' result despite errors?
Charlie <[email protected]>
| Newsgroups | gmane.comp.web.html-tidy.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Sebastien, Tidy is not great at preserving the visual representation of a page. I'm not sure if many people use it for that purpose. I never have myself. If that is my purpose, I look at Tidy's complaints and fix it by hand. I originally started working on Tidy to incorporate it into the publishing process in a Content Management System (CMS). This is a common use, I believe. In this case, the author should always have the opportunity to tweak the document before releasing the document. If you using Tidy for content aggregation (i.e. slurping content from a provider, but re-formatting for the target website), you need one of two things: a) a consistently formatted content source or b) a review process that allows format tweaks. With all of that said, you can get Tidy to emit at least well-formed XHTML (in the XML sense, perhaps not valid per the XHTML spec) while minimizing the, er, damage. Be sure to set the following to "no": --clean --bare --drop-font-tags --enclose-text --enclose-block-text Be sure to set --indent auto and --vertical-space no. Both yes and no will definitely affect the layout. I expended a great deal of effort to minimize visual artifacts with the auto indent scheme. I have not tested the current Tidy extensively to see if it still avoids whitespace inside table cells and inline elements. In many browsers (even newer ones) introduced whitespace can cause layout changes. hth, Charlie At 06:44 PM 3/14/2005 -0800, Sebastien Boisvert wrote: >I have a need to convert HTML input from any random >internet site into an XHTML document (for later >parsing into an XML parser and also display in a >browser), however I'm getting into problems when Tidy >detects errors. For example, if I try to parse the >page at mail.yahoo.com, it comes up with 3 errors; if >I force the output, the resulting code doesn't render >like the original in a browser. > >Is there a way to have Tidy handle errors in much the >same way browsers do so that the end result doesn't >change the way the document would be displayed by the >browser (ie. simply have a cleaned up version, with >the same 'errors' if need be)? ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click