here is a small comparison between SAX, DOM and STAX
╔══════════════════════════════════════╦═════════════════════════╦═════════════════════════╦═══════════════════════╦═══════════════════════════╗ ║ JAXP API Property ║ StAX ║ SAX ║ DOM ║ TrAX ║ ╠══════════════════════════════════════╬═════════════════════════╬═════════════════════════╬═══════════════════════╬═══════════════════════════╣ ║ API Style ║ Pull events; streaming ║ Push events; streaming ║ In memory tree based ║ XSLT Rule based templates ║ ║ Ease of Use ║ High ║ Medium ║ High ║ Medium ║ ║ XPath Capability ║ No ║ No ║ Yes ║ Yes ║ ║ CPU and Memory Utilization ║ Good ║ Good ║ Depends ║ Depends ║ ║ Forward Only ║ Yes ║ Yes ║ No ║ No ║ ║ Reading ║ Yes ║ Yes ║ Yes ║ Yes ║ ║ Writing ║ Yes ║ No ║ Yes ║ Yes ║ ║ Create, Read, Update, Delete (CRUD) ║ No ║ No ║ Yes ║ No ║ ╚══════════════════════════════════════╩═════════════════════════╩═════════════════════════╩═══════════════════════╩═══════════════════════════╝
there are different approaches for parsing an xml source. You should select proper approach for your needs. You may choose one of these:
- DOM - Document Object Model,
- SAX - Simple API for XML,
- StAX – Streaming API for XML