Ricky Ho wrote:
At the "Parser side, in both XPP and SAX code case, the parser deliver the same number of elements to the application "sequentially" (regardless of whether the application ask for it or the parser callback the application). So the Parser is doing same amount of work. Memory usage is minimum in both cases.
No it's not, and they're not doing the same amount of work. The SAX parser sends String and Attributes objects every time it does a startElement(). java.lang.String does an arraycopy of the characters that make up the string when it is constructed, even if the SAX parser later calls intern(). XPP only returns an event id. Internally, XPP need only maintain some pointers into a character buffer until you ask for the specific string you need.

-Baz



Reply via email to