Re: [xml] Streaming API for xml writing?
- From: "Yong Chen \(yongche\)" <chen cisco com>
- To: <xml gnome org>
- Subject: Re: [xml] Streaming API for xml writing?
- Date: Thu, 14 Jun 2007 15:20:43 -0700
Hi,
I just tested the streaming sample file, testWriter.c.
I tested only first part, testXmlwriterFilename("-"). (output file is
"-" which is stdout).
I see one issue: it doesn't look like it's doing streaming:
At some point (may be half way through), the func calls
xmlTextWriterEndElement() to finish one element. After this point, I
purposely added following lines:
fflush(stdout);
sleep(10);
Then the func continues to add other elements and finally closes the doc
and frees text writer.
I was hoping to see half of the elements printed out on screen when the
program hits "sleep()" statement, because those elements were already
added at this point.
But my test shows no elements where printed out when the program hits
"sleep()", and all elements were printed out at the same time at the end
of the test, when the func called "xmlFreeTextWriter" which internally
closes the output file.
Did I miss anything here? I want to output the elements while they are
being added to the doc, (so I don't need a big memory to hold a big doc
tree).
Another thing, how do I output the formated doc (indented doc)?
Thanks,
Yong Chen
-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Sent: Saturday, October 07, 2006 11:10 AM
To: Yong Chen (yongche)
Cc: xml gnome org
Subject: Re: [xml] Streaming API for xml writing?
On Fri, Oct 06, 2006 at 11:58:09AM -0700, Yong Chen (yongche) wrote:
Hi,
I know there's a streaming API for reading xml doc
(xmlTextReader). I wonder if there's a streaming API for writing?
Basically what I want to do is to write out xml doc when it's still
being built. This is to handle the situation that the final xml doc
may be too big to fit in memory (before it's written out).
Is xmlTextWriter the API for it?
yes, see also the discussion last week about this,
Is there any example/tutorial for it?
http://xmlsoft.org/examples/index.html#xmlWriter
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]