You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Stewart, Daniel J" <da...@boeing.com> on 2003/01/20 17:34:47 UTC

RE: is it possible to append instead of rewrite entire XML file o utput?

Catharina,

I needed the same feature, but for different reasons.

Our project records user entered data in XML files.  We have a requirement
to minimize any loss of user entered data due to program crash, power
outage, whatever. 

The implementation was to *APPEND* nodes to the DOM tree as the users
entered data, and then flush out only the new node to the file.  This has
two advantages:

1) Much faster to flush out one new node instead of the whole file
2) If there is a program crash before the entire DOM can be flushed to file,
at least the data is there, although it may be invalid XML because of a
missing end tag.  

As you found out, LocalFileFormatTarget does not support such an append
feature. 

I am including all of this information so that Xerces developers can
consider adding this feature.  I am sure there have been several other
programs which have similar transaction-type requirements.

My solution was to use Qt's DOM library for output, which does support
flushing a single node to a file in append mode.  As a bonus, it was
approximately 3 times faster than DOMWriter on Win32.  This made sense for
us because we were already using the Qt lib, otherwise I probably would have
investigated extending LocalFileFormatTarget.
  
Dan




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org