I'm guessing you're speaking of SAX parsers when you talk about event-
driven parsing.
If you take a look at the entity XML import code it actually is a SAX
event-driven parser.
As for other XML readers (like entity defs, widget XML files, etc,
etc) I'd be surprised if a SAX reader resulting in much performance
improvement, and it makes the code more complex, so the first step
would be to test it on one and do some performance tests to see if it
is any faster. The XML reading code already has some simple stuff to
test how long it takes, though to test this you should run it 100
times or something so the times are more meaningful (otherwise they
are probably less than 1ms and possibly not as accurate on the small
time scale).
Anyway, yeah, there are some general thoughts about it at least...
-David
On Apr 25, 2009, at 9:48 PM, Adrian Crum wrote:
OFBiz uses a lot of XML files. When each XML file is read, it is
first parsed into a DOM Document, then the DOM Document is parsed
into OFBiz Java objects. This two-step process consumes a lot of
memory, and it takes more time than it should.
There is an alternative - what is called event-driven parsing. The
XML parser can be set up to convert XML elements directly to the
OFBiz Java objects - bypassing the DOM Document build and parse
steps. Theoretically, this could provide a huge performance boost,
and it would use less memory. In addition, it would solve the
problem of huge XML files maxing out server memory during the parse
process - like with entity XML import/export.
Has anyone else considered this? Do you think it is worth pursuing?
-Adrian