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



Daniel Veillard wrote:
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
hi daniel,

thanks for the infos, but if the xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<log>
</log>

it also doesntindent:

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

patrick







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