HTML XML Use Case 08

From W3C Wiki

Using an XML toolchain to produce HTML

(this use case was added at the TAG F2F meeting 9 February 2011)

Problem statement

The user has some software that uses XML and related XML technologies (infoset-based, etc.) internally, but wishes to produce HTML that will be served as text/html.

Solutions

Use an HTML serializer in your HTML tool

Even if data is internally managed in XML, or XML-based DOMs, etc., it is possible to use serializers that produce HTML (I.e. content that would be properly interpreted if served as text/html).

Using polyglot markup (not generally applicable)

A solution that has been mentioned is using polyglot markup. This solution requires restricting the problem statement by stipulating additional restrictions on the properties of the text/html content to be produced.

The text/html content is constrained in such a way that when parsed as XML, it produces the same parse tree (except for how the xmlns attribute on the root element is represented) as it would produce if parsed using an implementation of the HTML parsing algorithm.

For the user to be able to produce text/html content using an XML toolchain, every document (s)he wants to consume has to be polyglot. If the content to be produced is Web content in general, there's no way to force all of it to be polyglot, and the polyglot solution isn't applicable.