After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644986 - Indent fails after comment with xmlTextWriter
Indent fails after comment with xmlTextWriter
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: xmlwriter
2.7.8
Other Linux
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2011-03-17 08:00 UTC by Adam Nielsen
Modified: 2021-07-05 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Adam Nielsen 2011-03-17 08:00:49 UTC
If you use xmlTextWriter with indentation enabled, after writing a comment followed by a closing tag, the closing tag is not indented.  If something else follows the comment then the closing tag is correctly indented.

Here is an example to demonstrate the problem.

#include <libxml/xmlwriter.h>

int main(void)
{
  xmlTextWriterPtr output = xmlNewTextWriterFilename("test.xml", 0);
  xmlTextWriterStartDocument(output, NULL, "UTF-8", NULL);

  xmlTextWriterSetIndent(output, 1);
  xmlTextWriterSetIndentString(output, BAD_CAST "\t");

  xmlTextWriterStartElement(output, BAD_CAST "root");
    xmlTextWriterStartElement(output, BAD_CAST "first");
      xmlTextWriterStartElement(output, BAD_CAST "second");
        xmlTextWriterWriteComment(output, BAD_CAST "closing tag below this will not be indented");
        // Uncomment this and the indenting works correctly
        //xmlTextWriterWriteElement(output, BAD_CAST "dummy", BAD_CAST "dummy");
      xmlTextWriterEndElement(output);
    xmlTextWriterEndElement(output);
  xmlTextWriterEndElement(output);

  xmlTextWriterEndDocument(output);
  return 0;
}

Output with 2.7.7 and 2.7.8:

<?xml version="1.0" encoding="UTF-8"?>
<root>
        <first>
                <second>
                        <!--closing tag below this will not be indented-->
</second>
        </first>
</root>
Comment 1 GNOME Infrastructure Team 2021-07-05 13:21:43 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.