Hi,

I read SAXPrint example but it parses an XML file and prints it out while I'd like to append XMLNode from memory to XML file.

Problem is because, with DOM, I cannot afford to build the whole DOM tree first since it involves a huge number of DOMNode. I need to put each DOMNode into the file right away after it is created and destroy it right away. Well, actually not even to put a few DOMNode first in a buffer since the application is at this moment rather crash-prone and I can't lose a single DOMNode that is already created (has quite vital info and need to have all, at least until the last moment before the crash :P, on the file)

SAX has the similar approach in writing to XML file, seems to me (but hey, me is newbie. Might got it wrong..). Although it does parse the XML file per node/attribute/..., not building tree in memory, and fires event after each parsing per node/attribute/...

My plan is to have each toBeCheckedObject creates its own check result report as an XMLNode and append the XMLNode to the XML file . The toBeCheckedObject and its XMLNode are destroyed right after writing to the file. Process repeats for  the next toBeCheckedObject

(all toBeCheckedObject(s) writes to the same XML file)

Is it possible..?

cath









"Oliver Kurowski" <[EMAIL PROTECTED]>

2003-01-16 07:54 PM
Please respond to xerces-c-dev

       
        To:        <[EMAIL PROTECTED]>
        cc:        (bcc: Catharina Ibrahim/EHV/TASS/PHILIPS)
        Subject:        Re: is it possible to append instead of rewrite entire XML file output?

        Classification:        




Hello Catharina!

Perhaps here comes SAX in. In my opinion, though I'm not an expert, too, you
can use the XMLFormatter interface to write the XML output (at least it does
the character conversion XML needs. The advantage is that there is no need
to hold the complete DOM tree in memory, since you write it part by part to
the output file. See the SAXPrint sample for further information.

Oliver

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 4:31 PM
Subject: is it possible to append instead of rewrite entire XML file output?


> Hi, I am meant to do checking on a huge number of objects in this manner:
> 1. Check object#1
> 2. Wraps report on object#1 as XML element
> 3. Write reportElement#1 to "report.xml" file
> 4. destroy object#1
> 5. Check object#2
> 6. Wraps report on object#2 as XML element
> 7. Append reportElement#2 to "report.xml" file
> 8. destroy object#2
> ....
>
> Using DOM, it seems to me that DOMWriter works by constructing the whole
> DOM tree first, parse it, and write it out to the file. But I cannot
> afford creating the whole DOM tree first since it is so huge.
>
> Is it possible to do this 'appending' or must I create a way around it?
> Tried to look at the milis archives but didn't find any info on this. Or
> maybe my eyes just missed it.. (sorry in that case)
>
> I'm new to this thingy; can really do all help :)
>
> thx a lot!
> cath


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to