Re: [xml] How to add newlines to output?



As far as I know from my examples you need to generate an own node for a newline (textnode with content "\n").

Kind regards

2009/10/13 <list burtbicksler com>
Hi,

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.
<root>
<first id="1">
<child1>ChildData</child1>
<child2>ChildData</child2>
</first>
</root>

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.

Thanks,
Burt



_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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