[xml] (X)HTML related proposals



Hi

I have encountered some (I think) annoying things in libxml2's (X)HTML
handling. I would propose patches, but I would like to first discuss
about the issues, to be sure not to go in bad directions.

So here we are :
- the htmlSetMetaEncoding() function just removes the existing
corresponding meta tag, if there was any, to add its own. Problem is
that text/html is not the only allowed content-type for (x)html files.
It could be application/xhtml+xml, for example. My proposal would be to
only touch the charset part of the meta tag if it already exists, and
not the mime type by itself, or provide some work around to set the
default mime type.
On the other hand, one may also want NOT to have the meta tag, if, for
example, he provides this information on the HTTP (or some other
protocol) level...

- By the way, the meta tag is not added if there is no head element.

- Output of XHTML follows the compatibility guidelines from the spec,
which is fine, but that should be disablable, I think.

- XHTML 1.1 is treated as pure XML, so that it doesn't get the special
treatment (meta tag addition, <script/> cdata-ing, etc.). Well, okay,
most of the special treatment is not needed for XHTML 1.1 (like adding
the lang attribute), but one may expect at least the meta tag to be
added, like in other XHTML data.

- In the crazy case of the presence of non namespaced html elements
inside a document, a namespace will be applied on it. Okay, this is a
VERY crazy case [1], but well...

Mike

[1] : small testcase:
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<h:html xmlns:h="http://www.w3.org/1999/xhtml";>
<h:body>
<h:div/>
<html>
</html>
</h:body>
</h:html>




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