[xml] patch for indenting comments/PIs in xmlsave
- From: Jason Viers <lists beanalby net>
- To: xml gnome org
- Subject: [xml] patch for indenting comments/PIs in xmlsave
- Date: Tue, 13 Mar 2007 12:50:30 -0400
When saving a new doc using indent, comments and PIs don't get indented
like elements do:
<?xml version="1.0"?>
<rootNode>
<item>child1</item>
<!--commentContents-->
<item>child2</item>
<?name value?>
<item>child3</item>
</rootNode>
Right now xmlNodeListDumpOutput indents the list item only if it's an
element. The patch changes it to indent if it's an element, comment, or
processing instruction.
Lemme know if there are any problems or questions.
Jason
--- xmlsave.c 2006-10-16 20:25:06.000000000 -0400
+++ ../xmlsave.c 2007-03-13 12:36:45.951692500 -0400
@@ -623,7 +623,9 @@
buf = ctxt->buf;
while (cur != NULL) {
if ((ctxt->format) && (xmlIndentTreeOutput) &&
- (cur->type == XML_ELEMENT_NODE))
+ (cur->type == XML_ELEMENT_NODE ||
+ cur->type == XML_COMMENT_NODE ||
+ cur->type == XML_PI_NODE))
xmlOutputBufferWrite(buf, ctxt->indent_size *
(ctxt->level > ctxt->indent_nr ?
ctxt->indent_nr : ctxt->level),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]