Re: [xml] Question about saving XML files

On Fri, Oct 05, 2001 at 07:35:28AM -0700, Chris wrote:
Daniel Veillard wrote:
Thanks., it does.

I used the "dangerous way" and it seems to work like I expected it to.

If I really wanted to do it  it "the correct way", do I generate text 
nodes with something like xmlNewTextChild and just put a "\n" in them ? 
Is that what XmlSaveFormatFile does ?

  Well this is the base idea, but it can be a bit more complex actually.
The key point is that the saving routine should save what's in the tree,
no more, no less. Expecting it to not do so cannot be easilly controlled.
The only way to have full control is to add whatever formatting you expect
directly in the tree, be it simple \n before opening tags or spaces to
indent or \n only at the end of emement without existing text content or...


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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