Re: parsing html / xml (more)
| From: | Matt McClanahan | Date: | Wed, 07 Mar 2001 19:06:35 +0000 |
| Subject: | Re: parsing html / xml (more) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42936@lists.php.net to get a copy of this message | ||
On Wed, Mar 07, 2001 at 10:07:37AM -0700, Nathaniel Hekman wrote:
> Here's another case that shows up often in html, but is illegal in xml, that
> I would need to parse: meta tags, <p> tags, <hr> tags, and other
> "singletons".
>
> <HEAD>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html">
> </HEAD>
>
> xml_parse would give an error, because the HEAD block is being closed with a
> still-open META "block".
Within the context of parsing HTML as XML, there's not really much that
can be done. I suppose you could pre-proces the HTML to make it
XML-complaitn, but that's probably more trouble than I would go to.
You're not going to find an XML parser that allows for most HTML,
because if such a parser did exist, it would be a broken XML parser. :)
The only kind of HTML you can reliably parse with XML parsers is the
XHTML variety (Which is simply HTML4, made XML-compliant)
Matt