Using file objects with elementtree

D

dj

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.
 
C

castironpi

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.

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

Diez B. Roggisch

dj said:
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.

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
 
C

castironpi

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

What do we render?
 
C

castironpi

Sur.

Stefan

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top