ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Zk 5.0.10 seemingly generates invalid html markup

cvarona
9 Feb 2012 11:51:54 GMT
9 Feb 2012 11:51:54 GMT

Hi,

I'm trying to use some of the available open source html2image utilities available in order to capture the html generated by the zul renderer into an image. While html2image does accept and process the html I fed to her by applying the tip in this forum question, flying saucer complains about the provided html not being valid. I've inspected the obtained html and compared it with that unveiled by using firebug's html inspector. They're the same and do indeed contain invalid html markup, for instance:

    <div class="z-vlayout-inner" id="dFUYt3-chdex">
        <img src="/zksandbox/zkau/view/z_9m00/dFUYt3/a4h1/1/c/captcha1328787157810.png" style="width:150px;height:50px;" id="dFUYt3">
    </div>

Am I doing something that might prevent the html from being generated or retrieved as valid markup? Is it some bug to be fixed in a forthcoming zk release?

With kind regards

César Varona

matthewgo
15 Feb 2012 01:38:55 GMT
15 Feb 2012 01:38:55 GMT

Hi César,
Do you mean the img tag does not have a end tag ?

cvarona
15 Feb 2012 07:52:55 GMT
15 Feb 2012 07:52:55 GMT

Hi Matthew,

yes, and it's only an example. Other samples of not well-formedness can be found as well.

gekkio
15 Feb 2012 12:53:23 GMT
15 Feb 2012 12:53:23 GMT

You cannot do that kind of reasoning about HTML validity with Firebug's HTML inspector, because Firebug only sees the internal representation, not the source HTML that was used. You can verify that yourself by inspecting any img tag in any website. Even if the source HTML contains the self-closing tag, it will not appear when inspecting the element (at least in FF10).
The same thing applies to the innerHTML property in Javascript that is used in the forum post you mentioned. Here's a relevant stackoverflow question

It's also worth noting that HTML5 makes self-closing tags optional, so that markup is actually valid HTML 5.

cvarona
15 Feb 2012 13:53:27 GMT
15 Feb 2012 13:53:27 GMT

Hi Gekkio,

thanks for your accurate and well documented reply. I'm aghast at these details about Html5. I had never expected well-formedness would not become common law.

With kind regards

César Varona