ID:               43754
 Updated by:       [EMAIL PROTECTED]
 Reported By:      karel dot smutny at gmail dot com
 Status:           Open
 Bug Type:         XML Writer
 Operating System: Windows XP SP2
 PHP Version:      5.2.5
 New Comment:

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. :)


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to