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
> 
> <foo>blah</foo>
> <foo>bar</foo>
> 
> rather than
> 
> <foo>blah</foo><foo>bar</foo>

 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.

> Second:
> 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.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to