Re: [xml] Writing xmlNodePtrs out with xmlSaveTree
- From: Daniel Veillard <veillard redhat com>
- To: David Hagood <wowbagger sktc net>
- Cc: xml gnome org
- Subject: Re: [xml] Writing xmlNodePtrs out with xmlSaveTree
- Date: Fri, 29 Sep 2006 16:29:35 -0400
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/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]