[xml] htmlDocDumpMemory() vs xmlDocDumpMemory()

I am processing XHTML source files, rendering them to HTML strings, then loading the HTML string into a browser control (Webkit).

Originally I was generating the string by calling xmlDocDumpMemory(), but I kept reading articles that suggested you render as HTML if the result is being displayed by a browser. I changed to use htmlDocDumpMemory(), and my application still worked with no problems.

Recently, however, we were developing a new set of web pages, and I had occasion to load the HTML string output into a real browser (Safari), by first writing the HTML string to a file, then opening the file in the browser. To my surprise, the JavaScript error console displayed quite a few errors. Many of them were complaints that the HTML contained element pairs such as "<br></br>", or "<p></p>". Someone had asked be why we had extra blank lines in the browser display, and I finally realized it was because Safari was treating <br></br> as <br><br> (which is what the error message said it would do).

The source code in these cases contains <br />, <p />, etc. and I just verified that if I call xmlDocDumpMemory() that is what ends up in the output string. How can I achieve the same result using htmlDocDumpMemory? Or is there some other way I should be doing this?


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