Mar-18-2020, 07:46 AM
Hi,
I'm just being curious
When i program with an xml database, i can e.g. add a new "record",
and even add a new field to existing records in the database etc.(using elementTree)
It strikes me that during those operations you never say something like
"save" or "additem", or...
Only a the very end one does a tree.write(...),
and that (probably) overwrites the existing xml file.
My question: you start by reading the existing xml (db = ET.parse('members.xml')
and this keeps the whole thing in memory until the moment that you do tree.write?
I can imagine issues when the computer crashes.
So, is it best proctice to do multiple tree.write()s during operations?
thx,
Paul
I'm just being curious

When i program with an xml database, i can e.g. add a new "record",
and even add a new field to existing records in the database etc.(using elementTree)
It strikes me that during those operations you never say something like
"save" or "additem", or...
Only a the very end one does a tree.write(...),
and that (probably) overwrites the existing xml file.
My question: you start by reading the existing xml (db = ET.parse('members.xml')
and this keeps the whole thing in memory until the moment that you do tree.write?
I can imagine issues when the computer crashes.
So, is it best proctice to do multiple tree.write()s during operations?
thx,
Paul