[Haskell-cafe] How to force HTML (rather than XML) output from Haskell XML Toolbox?

Jared Updike jupdike at gmail.com
Wed Aug 30 14:05:10 EDT 2006


> which is close but not exactly as wanted. The <meta> (and I expect
> other tags like <br> will have the same) tag has closing slash as it
> would have in XML (XHTML), but not in HTML. Also the DOCTYPE has been
> lost.

I've had similar problems outputting XHTML. For example, naive output
(correct according to the definition of XML and (X)HTML) breaks in IE
because IE doesn't like <link ... />  or <script ... /> tags, instead
it wants <link ...></link>  and <script ...></ script>. Pages with
correct XHTML, but with these "unhappy" tags in the HTML <head>, load
in IE as a blank page! To make pages that will load in 90% of
browsers, I've always generated my own (X)HTML with special pretty
printers that know these caveats and a few others.

  Jared.

On 8/30/06, Dimitry Golubovsky <golubovsky at gmail.com> wrote:
> Hi,
>
> I am developing a code that reads a HTML page (template), modifies it
> (adds some stuff) and then writes the output file which is to be HTML,
> not XML.
>
> I use hxt-5.3 (but I may upgrade if necessary).
>
> It is desired to preserve the original HTML template pieces maximally
> close to the original.
>
> But output appears to be closer to XML rather than HTML.
>
> The code I use:
>
> ====================
>
>   let attrs = [(a_parse_html, "1"),
>                (a_output_xml, "0"),
>                (a_encoding,   utf8)]
>
>   (res, err, rc) <- getXmlDocument attrs (fromJust $ tmplPath dopt)
>
>   putXmlDocument attrs (fromJust $ outPath dopt) res
>
> =====================
>
> for this input HTML file:
>
> =====================
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>   <title>Empty Page Template for Haskell Applications</title>
>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">
> </head>
> <body>
> </body>
> </html>
>
> =====================
>
> outputs:
>
> =====================
>
> <html>
> <head>
>   <title>Empty Page Template for Haskell Applications</title>
>   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
> </head>
> <body>
> </body>
> </html>
>
> =====================
>
> which is close but not exactly as wanted. The <meta> (and I expect
> other tags like <br> will have the same) tag has closing slash as it
> would have in XML (XHTML), but not in HTML. Also the DOCTYPE has been
> lost.
>
> Is this something hxt is not able to provide, or just a bug fixed
> since 5.3? Or should I write my own output code (because I am
> guessing, hxt functionality regarding manipulation over XML trees is
> sufficient for what I need)? Or should I use another package?
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


-- 
http://www.updike.org/~jared/
reverse ")-:"


More information about the Haskell-Cafe mailing list