[jdom-interest] Updating one or two tags in a large file

Mark J Laird Markl at waterford.org
Wed Feb 14 11:48:15 PST 2001


Hi all,

I am using JDOM to create XML error log files.  The file consists of a
small header structure followed by error log entries.  This file can
become quite large, depending on the number of errors.

At certain points in the product's life cycle, it is necessary to change
the header information at the top of the file.  Currently, I am doing
this by reading in the entire file, updating the two tags that change in
the header, and then writing the whole file back out.  This is time
consuming, especially for large files.  It seems almost ridiculous to
have to read in the entire file just to change two tags, but I haven't
found any other way to do it.  Does anyone know of a way to update the
tags in the header without having to read in the entire file?

My XML structure is as follows.  Thanks in advance.


<Error_Log>
    <Header>
        <Version>3.0</Version>
        <ComputerName>Vader</ComputerName>
        ...
    </Header>
    <Logs>
        <Log_Entry>
        <Log_Entry>
        ...
    </Logs>
</Error_Log>


Mark




More information about the jdom-interest mailing list