diff --git a/src/writer/emitter.rs b/src/writer/emitter.rs index 28542274..ba80f667 100644 --- a/src/writer/emitter.rs +++ b/src/writer/emitter.rs @@ -401,6 +401,7 @@ impl Emitter { pub fn emit_characters(&mut self, target: &mut W, content: &str) -> Result<()> { + self.check_document_started(target)?; self.fix_non_empty_element(target)?; target.write_all( (if self.config.perform_escaping {