[xml] =?utf-8?q?How_to_add_newlines_to_output=3F?=


New to libxml(2) and generally have things pretty well figured out but one issue that I haven't been able to work out is the following:

I am using the API to create a record of the form:
<root><first id="1"><child1>ChildData</child1><child2>ChildData</child2></first></root>

I would like the resulting xml when saved to a file to be formatted like this.
<first id="1">

I found a discussion in the archives that almost addresses this by referring to an FAQ entry #3 which says the preferred way is to generate the formatting yourself.  I would like to do that but so far every API I have tried to use doesn't seem to accomplish what I need to get the resulting formatting.

What specific API, with a minimal example, needs to be used to add the newline (and optional spaces) after each node entry?  If I have missed the specific API / example in the docs please point me to that area of the documentation.


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