Re: [xml] Writing xmlNodePtrs out with xmlSaveTree

On Fri, Sep 29, 2006 at 12:56:35PM -0500, David Hagood wrote:
I have a couple of questions on writing out an XML element and its
children with xmlSaveTree:

First, is there any easy way to tell xmlSaveTree to write a line break
after completing a node - so that things get written out like


rather than


 No, spaces are significant in XML, in general you can't ignore or 
add them randomly.

Or do I just need to write it myself - and if so, is there a simple way to
use the xmlSaveCtxtPtr to write the break?

 Make a text node with a single cariage return and serailize it.

Is there any way to force a given indention level, so that I can start
writing a document (i.e. write the xml, DOCTYPE, and root node), then
repeatedly call xmlSaveTree to write the sub-elements properly indented
within the root node?

 Again, no, spaces are significant, and while there is support for indentation
for whole document there is no provision for single nodes.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
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]