#43754 [Opn->Csd]: XMLWriter::fullEndElement produces wrong indentation
| From: | felipe@php.net | Date: | Wed, 09 Jan 2008 09:47:09 +0000 |
| Subject: | #43754 [Opn->Csd]: XMLWriter::fullEndElement produces wrong indentation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121155@lists.php.net to get a copy of this message | ||
ID: 43754
Updated by: felipe@php.net
Reported By: karel dot smutny at gmail dot com
-Status: Open
+Status: Closed
Bug Type: XML Writer
Operating System: Windows XP SP2
PHP Version: 5.2.5
New Comment:
I reported this bug, and already fixed in SVN (libxml).
http://bugzilla.gnome.org/show_bug.cgi?id=508156
Previous Comments:
------------------------------------------------------------------------
[2008-01-08 21:13:33] felipe@php.net
AFAIK, this is a bug in Libxml. Seeing the source in
http://cvs.gnome.org/viewcvs/libxml2/xmlwriter.c?rev=1.37&view=markup
in xmlTextWriterFullEndElement() is missing:
if (writer->indent) {
count = xmlOutputBufferWriteString(writer->out, "\n");
sum += count;
}
That is founded in xmlTextWriterEndElement() (called from endElement()
in PHP extension), and works fine. :)
------------------------------------------------------------------------
[2008-01-04 21:20:54] karel dot smutny at gmail dot com
Description:
------------
fullEndElement() procedure produces wrong indentation when called
setIndent(true). There is no new line and indentation before tag
following another end tag produced by fullEndElement().
Reproduce code:
---------------
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startElement('body');
$xml->startElement('div');
$xml->writeAttribute('id', 'all');
$xml->startElement('div');
$xml->writeAttribute('id', 'header');
$xml->fullEndElement();
$xml->startElement('div');
$xml->writeAttribute('id', 'content');
$xml->fullEndElement();
$xml->startElement('div');
$xml->writeAttribute('id', 'footer');
$xml->fullEndElement();
$xml->fullEndElement();
$xml->fullEndElement();
echo $xml->outputMemory();
Expected result:
----------------
<body>
<div id="all">
<div id="header"></div>
<div id="content"></div>
<div id="footer"></div>
</div>
</body>
Actual result:
--------------
<body>
<div id="all">
<div id="header"></div> <div id="content"></div>
<div
id="footer"></div></div></body>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43754&edit=1