Re: [xml] Parsing tag-soup HTML

On Mon, 18 Jun 2007 15:08:53 +0200
Stefan Behnel <stefan_ml behnel de> wrote:

Nick Kew wrote:
On Mon, 18 Jun 2007 08:14:01 -0400
Try running the following through "xmllint --html":

<meta http-equiv="content-type" content="text/html;charset=ascii" />
<html lang="en">
<body><h1>Hello, World</h1></body>

In that case I would actually prefer making it a general special case
rule in the current parser to interpret a leading <meta> tag as an
encoding hint to the parser. That would add quite a portion of
real-world non-HTML to the set of parsable (i.e. fixable) documents.


That's what I've done in that specific case.  An ad-hoc fix
to a specific instance of bad markup.  It does nothing for
a similar case, like

<html lang="en">
<h1>Hello World</h1>
<body><p>Some contents here</p></body>

which HTMLparser fixes to

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<html lang="en"><body>
<h1>Hello World</h1>
<h1>Hello, World</h1>

I'm trying to get away from ad-hoc fixes!

Nick Kew

Application Development with Apache - the Apache Modules Book

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]