Disadvantages of Event-Driven Parsers


Event-driven parsers have several disadvantages compared to DOM- or tree-based parsers.

Event-based parser applications are more difficult to develop than the equivalent DOM-based parser application. In an event-driven parser application, the data is pushed into the application by the parser, so the application must be prepared to accept and process the data using a series of event handler subroutines. The subroutines aren't difficult to develop, especially after you have a sample application to use as a template, but it does require some time and effort on your part. An application built using a DOM- or tree-based parser behaves a little differently in that the parser builds a tree, and it is the responsibility of the application to retrieve the data. So, the DOM-based parser handles the storage of the XML data (in the form of a tree), while an event-based parser application is required to store data based on parser-driven events.

Another disadvantage of an event-based parser is that it doesn't have the concept of an entire XML document nor of an XML document's hierarchical structure.Yes, this was listed as an advantage, and I consider it to be more of an advantage than a disadvantage , but there are times when you want to operate on an entire XML document. This is easy to do with a DOM- or tree-based parser because the entire document is already stored in memory. To do this in an event-based parser application, you would need to develop a custom data structure to store the data. This is not a big problem, but it does cause some additional work.



XML and Perl
XML and Perl
ISBN: 0735712891
EAN: 2147483647
Year: 2002
Pages: 145

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net