Re: [xml] about indentation

On Fri, Mar 03, 2006 at 07:58:21PM +0100, nico wrote:
hi all,
i use xmlSaveFileEnc() to save tree modification.

when i update a node, it's perfect

when i add a node to a document (done with xmlAddChild), the resulting 
document  isn't well indented.
my code is the same as tree2.c .
i got this format:

or i would like to have

thank you for any help,

  libxml2 will not add other text nodes children if a node already has 
text child. That's imposed to avoid breaking content when nodes have 
a mixed-content model.
  The only ultimate way to garantee indenting while not detroying data
is for you to add the text nodes when you think it makes sense.


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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