Re: [xml] htmlDocDumpMemory() vs xmlDocDumpMemory()

Hi Julien,

On Mar 1, 2009, at 2:06 AM, Julien Chaffraix wrote:

Hi Rush,

Here is a sample of rendered output, using htmlDocDumpMemory():

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Ok, so here is the line that causes your troubles. This doctype puts
the document in quirks mode. Switching to the following version (the
strict HTML 4.0 doctype) should solve your issue.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">

It may be even better to drop the end and use instead

It is what HTML5 requires (see

As it turns out, my real problem is that I process this with a XSL stylesheet, and its output statement is incorrect for generating XHTML. If I correct that, then I can specify anything in my XHTML page source doctype declaration (including my DTD) and libxml will generate the strict XHTML doctype in the output when I use xmlDocDumpMemory().


To me, the XHML output looks to be better behaved and it sounds like your
recommendation would be to keep my output as XHTML.

If you just want to test your output in a browser then XHTML is fine
(which is what I thought you were trying) and will not require much
effort so I would go for it.
If you need to ship for all browsers, then it will not do as Internet
Explorer does not support XHTML.

My app is a special purpose browser that must work cross platform. I changed my XSL stylesheet to generate html when I was trying to make the Windows version work using their browser control. That was the start of my two step screw up, finished when I changed to use htmlDocDumpMemory().

I'm experimenting with Qt, since they make Webkit available on all platforms. If that works out I will change my XSL so it generates strict XHTML. If it doesn't work out, I'll need to so something nasty to deal with Windows. I'm hoping for Qt. :-)

Thank you very much for the help,

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