|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
How to add newlines to output?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@... http://mail.gnome.org/mailman/listinfo/xml |
|
|
Re: 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@...>
_______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@... http://mail.gnome.org/mailman/listinfo/xml |
|
|
Re: How to add newlines to output?list@... wrote:
> 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. > const int indentTreeOutput = 1; xmlSaveFormatFileEnc(filename, pDoc, "UTF-8", indentTreeOutput); This is what I use to format my final file. br, Martin _______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@... http://mail.gnome.org/mailman/listinfo/xml |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |