Re: [BULK] - Re: Deleting a Node
by Bruce Miller other posts by this author
Nov 13 2006 10:54AM messages near this date
view in the new Beta List Site
RE: [BULK] - Re: Deleting a Node
|
RE: [BULK] - Re: Deleting a Node
& XSLT Mesdaq, Ali wrote:
> Well a DB is really way over doing what I need. The process that is
> running will be running on a temporary computer and it will be wiped out
> after each complete run. Performance is also not really that important.
>
> Ideally what I would like to do is just iterate through the list of
> nodes and just delete and commit to disk. But it starting to sound like
> libxml is not meant for writing to disk or manipulating xml that is
> meant to be written back to disk.
Sure it is. It's just not meant to replace a database.
Presumably it's either expensive, or "wrong" to
process a node more than once (in case of some failure).
Writing the entire xml data back to file after each
operation may or may not be too expensive; depends on
the size. If you're so worried about crashes in the
middle of processing, you do have to worry what happens
to your data if it crashes in the middle of a write.
Of course, you do with _any_ process; that's one of
the things you get with a (good) database, is that
transactional failsafe.
And I guess if you're thinking of the XML operations
as being file-based, then I guess I can better understand
the questions you asked in your original message:
If the system crashes in the middle of a delete,
can the data be corrupt? Well, yes...
Anyway, I'd suggest thinking of some alternative ways
of thinking about the problem. Instead of modifying
the xml data, maybe store an ID of each processed node
in an extra file. It'll be smaller and less prone
to corruption. Maybe even some sort of checksum along
with the id to verify that those stored ID's are valid.
So, when you restart and start processing the XML,
you'd skip the ones that were successfully processed.
> -----Original Message-----
> From: Robin Berjon [mailto:robin@[...].com]
> Sent: Monday, November 13, 2006 10:15 AM
> To: Mesdaq, Ali
> Cc: perl-xml@[...].com
> Subject: Re: [BULK] - Re: Deleting a Node
>
> On Nov 13, 2006, at 18:54, Mesdaq, Ali wrote:
> > Will this commit to the file right away?
>
> No, XML processing does not normally commit back to file. If you want
> to do that you'll have to write the file back yourself with every
> single modification, which is going to be slow. You probably want a
> database if that's what you need.
>
--
bruce.miller@[...].gov
http://math.nist.gov/~BMiller/
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Ali Mesdaq
Liam Quin
Bruce Miller
Chilkat Software
Ali Mesdaq
Robin Berjon
Ali Mesdaq
Bruce Miller
Ali Mesdaq
Bruce Miller
Ali Mesdaq
John Saylor
|