StAX Streaming Parser and DOM Tree Builder Interoperability: Memory Footprint at Integration Boundary
0 reputation · 04 Feb 2021, 14:52 UTC
StAX provides a low‑memory, event‑driven API while DOM builds a complete in‑memory tree, creating a mismatch when the two are combined at an integration point.
Goal: design a pattern that allows StAX to supply parsed fragments to a DOM builder without causing unbounded memory growth, especially for documents exceeding 100 MB.
Uncertainty remains about whether the DOM implementation can accept incremental node insertion and how character‑encoding handling interacts with the streaming cursor, given JVM‑specific memory management and GC tuning. How can StAX be used to feed DOM construction while keeping peak heap usage bounded? Is there an API to limit DOM node creation to a subset of the document during streaming? Which JVM GC configurations reduce OutOfMemoryError risk when both parsers operate concurrently?