Friday, 30 August 2013

faster multiple parsings : SAX or DOM

faster multiple parsings : SAX or DOM

I read many posts that SAX is faster than DOM. I am not sure if my
question is silly but i think DOM must be faster if we have huge
memory.Cause once the tree structure is loaded into memory then it should
be faster than SAX.
I need some clarifications here, please help me in understanding. I have a
use case where i receive a huge file to parse multiple times everyday. Can
i say DOM might be bit slower than SAX while parsing for the first time,
and all subsequent parsings will be tremendously faster in case of DOM as
it loads the entire document structure in memory and reuses it. If so ,
then how can we say that SAX is faster than DOM .Please correct me if i am
wrong. And if tomorrow i change my XSD and need to push the new structure
into memory then is there any way to do it without restarting the
application.

No comments:

Post a Comment