Re: Using xmlNewTextWriterTree with indentation

"Vuille, Martin (Martin)" <[email protected]>
Newsgroups gmane.comp.gnome.lib.xml.general
Message-ID <30C2D590D16A5C46ADFE6521910377988D97165E@AZ-US1EXMB02.global.avaya.com>
Never mind, fixed my own problem.

I was using xmlTextWriterSetIndent() to enable identing
and xmlSaveFileEnc() to write the doc to a file.

Switching to xmlDocFormatDump() for writing gives me
the result I need.

MV

From: xml [mailto:[email protected]] On Behalf Of Vuille, Martin (Martin)
Sent: March 21, 2017 16:30
To: [email protected]
Subject: [xml] Using xmlNewTextWriterTree with indentation

I am trying to use xmlNewTextWriterTree to add some elements
to a doc tree. I would like the new elements to be indented according
to their depth in the tree. But it seems the indentation level is starting
from 0.

Is there a different way for me to go about this?

I have:

<A>
  <B>
  </B>
</A>

I am using xmlNewTextWriterTree with the 'node' argument pointing
to the 'B' element.

I would like to end up with something like this:

<A>
  <B>
    <C>
      <D>
      </D>
    </C>
  </B>
<A>

But instead I get:

<A>
  <B><C>
  <D>
  </D>
<C></B>
</A>

Any pointers appreciated.
MV

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.