[xml] xmlTextWriterSetIndent question
- From: "taihei goi" <taihei sis saison co jp>
- To: <xml gnome org>
- Subject: [xml] xmlTextWriterSetIndent question
- Date: Fri, 30 Jan 2004 19:24:35 +0900
Hi.
I'm using libxml2.6.5 on redhat7.3.
I have searched ML archive and CVS but I could not find the solution,so I
post here.
Problem is:
I have used xmlwriter api and received an output differ from my expectation.
The output file(end tag of element <B>) is not properly indented.
Output of xmlWriter api :
<?xml version="1.0"?>
<A>
<B>
<C ID="1"/>
</B>
</A>
My expectation is:
<?xml version="1.0"?>
<A>
<B>
<C ID="1"/>
</B>
</A>
Question is:
Is this the intended behaviour or a bug ?
Thanks.
taihei
Source Code:
#include <libxml/xmlwriter.h>
int main(void) {
xmlTextWriterPtr writer;
writer = xmlNewTextWriterFilename("test.xml", 0);
xmlTextWriterSetIndent(writer,1);
xmlTextWriterSetIndentString(writer," ");
xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
xmlTextWriterStartElement(writer, "A");
xmlTextWriterStartElement(writer, "B");
xmlTextWriterStartElement(writer, "C");
xmlTextWriterWriteAttribute(writer, "ID", "1");
xmlTextWriterEndElement(writer); //end of C
xmlTextWriterEndElement(writer); //end of B
xmlTextWriterEndElement(writer); //end of A
xmlTextWriterEndDocument(writer);
xmlFreeTextWriter(writer);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]