Re: [xml] No Newlines at the end of a node



On Wed, Jul 23, 2008 at 10:30:45AM +0200, Patrick Steiner wrote:
all works fine, but the output looks ugly. there are no newlines after a 
node. there is also no indent.

here is the output:

<?xml version="1.0" encoding="UTF-8"?>
<log>
<message time="20080722" type="0" number="664">foobar</message><message 
time="20080722" type="0" number="664">foobar</message></log>


any ideas how i can fix this?

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

add the text nodes you want/need for formatting.
Libxml2 detected there was already text nodes as sibling of your new node
so it's a mixed content parent, and it won't create indentation nodes as 
a result.
Other option is to remove all the existing indentation nodes in
the document, in that case libxml2 automatic formatting may work.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]