Validating vs non validating parsers with xml
Both DOM and SAX have features that make them more suitable for certain tasks than others: Omitting the impact of memory consumption on overall system performance, processing using the DOM API is usually slower than processing using the SAX API, mainly because the DOM API may have to load the whole document in-memory first in order to allow it to be edited or data to be easily retrieved, while the SAX API allows immediate processing as the document is being parsed.
Processing an XML document means recognizing, extracting and directly processing the element contents and attribute values or mapping them to other business objects that are processed further on.
Before an application can apply any business logic, the following steps must take place: Parsing XML documents implies a lot of character encoding and decoding and string processing.
The physical structure and the logical structure of an XML document may be different.
An XML document may contain references to external entities which are substituted in the document content while parsing and prior to validating.
If a document model fits the core data structure of an application, JDOM and dom4j should be seriously considered.