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:
<step1><cue>1</cue><universe>0</universe></step1>

or i would like to have
<step1>
    <cue>1</cue>
   <universe>0</universe>
</step1>


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

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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