Web / Apache Axiom Interview questions
Which is better for large XML processing: Axiom or DOM, and why?
For most large-XML and especially SOAP-messaging scenarios, Axiom is generally the better fit, precisely because its deferred building and native MTOM support avoid the two biggest costs a large payload otherwise imposes: eager full-tree materialization and base64-inflated binary content.
DOM remains the stronger choice, however, when an application genuinely needs the full document available and randomly mutable immediately - heavy, whole-document XPath querying right after parsing, for instance - since in that case Axiom's laziness offers little benefit (the whole tree gets built anyway) while DOM's simpler, always-eager model and strict W3C standard compliance can be easier to reason about and integrate with tooling that expects genuine org.w3c.dom objects.
| Favors Axiom | Favors DOM |
| Large payloads, only part inspected | Full document needed immediately, heavily |
| SOAP messaging with attachments | Strict org.w3c.dom API requirement |
| High-throughput services | Simpler, more predictable eager model |
It's worth noting the choice isn't strictly binary - Axiom's axiom-dom implementation exposes genuine DOM-compatible objects while retaining Axiom's underlying deferred-building behavior, which can split the difference for applications with mixed requirements.
More Related questions...