XML interview question · Most asked

How would you process a 10 GB XML file?

Create a free account to save this page, take notes and track your progress. Sign in

Summary

Stream it: lxml/ElementTree iterparse with clear() and deletion of processed siblings, PHP XMLReader expanding one record at a time, or Java StAX/SAX. Process in batches with checkpoints so a crash resumes, validate per record, and keep memory flat regardless of size.

Longer Answer

Plain iterparse without clearing still builds the full tree. Also consider asking the producer for incremental (delta) feeds.

Key Points

  • Streaming parser.
  • Clear processed elements.
  • Batches and checkpoints.
  • Per-record validation.

Deep dive: XML in Production: The 4 GB Product Feed

Explanation

What interviewers look for

The clearing detail and resumability.

More most-asked XML questions

← All XML questions

Was this page helpful?