Pattern
Streaming HTML Serialization Callback
callback-driven-serialization-order
Lexbor HTML serialization requires a write callback, so attempting to save the DOM with QFile before serialization runs leaves you with empty/missing output; you must serialize-to-callback or persist the produced buffer.