[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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]