Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using file objects with elementtree

0 views
Skip to first unread message

dj

unread,
May 14, 2008, 4:09:32 PM5/14/08
to
Hello,

Rather then holding my XML document in memory before writing it to
disk, I want to create a file object that elementtree will write each
element to has it is created. Does any one know how to do that ?

Here is my code so, far:

fd = open("page.xml", "w")
tree.write( fd, encoding="iso-8859-1")

I know there's something I am doing wrong, but I just do not know
what.

casti...@gmail.com

unread,
May 14, 2008, 6:34:17 PM5/14/08
to

Sure. Relational databases are more widely useful. They're the
binary hold-on-disk for you-- a big XML file.

Diez B. Roggisch

unread,
May 14, 2008, 6:41:00 PM5/14/08
to
dj schrieb:

This isn't possible. How should ET handle the case that you add a
child-node to a node that has been rendered already?

What you could try is to serialize subtrees that are closed to a stream.


Diez

casti...@gmail.com

unread,
May 14, 2008, 7:54:56 PM5/14/08
to

What do we render?

Stefan Behnel

unread,
May 15, 2008, 2:14:43 PM5/15/08
to casti...@gmail.com
casti...@gmail.com wrote:
> What do we render?

Sur.

Stefan

castironpi

unread,
May 15, 2008, 7:56:42 PM5/15/08
to
On May 15, 1:14 pm, Stefan Behnel <stefan...@behnel.de> wrote:

I'm pretty sure 'inputs' come from the real world. I guess the fear
would be my hands aren't happy. Concerns include age fitity, a
propriety, and making up words. Blah?

Stefan Behnel

unread,
May 16, 2008, 5:49:22 AM5/16/08
to castironpi
castironpi wrote:
> [...], and making up words. Blah?

"Blah" is not made up. Try again.

Stefan

PS: this might be getting slightly off-topic...

0 new messages