Re: [xml] \n or \r missing when adding text-content



On Tue, May 10, 2005 at 03:18:36PM +0200, Remy HAREL wrote:
In fact, I'm building a xml tree from scratch, I'm not trying to read an 
existing one. The main problem is that I can't add text to a node 
without losing all sub-nodes \n and/or \r.

  I think I start to understand.

 When I dump the tree, all xml nodes after the text part are dumped on 
only one line.
  
  You are asking libxml2 to indent your document.
In XML all text, including "blanks" are significant.
When you have a node which has a text children, then libxml2
will not add any formatting spaces underneath because 
this means that text nodes are significant in this context.
The only way is to not let libxml2 guess about what is
significant or not since it will refuse to take risk 
and add the text node used for indentation yourself.

  Developper FAQ #3 
    http://xmlsoft.org/FAQ.html#Developer

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team 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]