[xml] Duplicate end-tags in htmlNodeDump



I am failing to understand the following sequence in HTMLtree.c
/ htmlNodeDump. More accurately, I cannot see the point with the
last three lines.

    if (!htmlIsAutoClosed(doc, cur)) {
        xmlBufferWriteChar(buf, "</");
        xmlBufferWriteCHAR(buf, cur->name);
        xmlBufferWriteChar(buf, ">");
    }
    xmlBufferWriteChar(buf, "</");
    xmlBufferWriteCHAR(buf, cur->name);
    xmlBufferWriteChar(buf, ">");

htmlIsAutoClosed returns true "if a tags is autoclosed by one of
it's children" (if 'autoclosed' implies that an end-tag is inserted
then I suspect that two end-tags will be inserted in this case, but
I have not verified this). If htmlIsAutoClosed returns false, then
two identical end-tags will be inserted. Why?

My problem is that much of my HTML output have two end-tags per
start-tag, which is fatal for embedded tags. Removing the last
three lines above, seemed to solve this problem. As I was under
time pressure, I did not had time to understand or experiment
with the code, nor did I run the regression tests.




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