Skip to content

Commit

Permalink
Force XML document declaration to be output before characters
Browse files Browse the repository at this point in the history
The 'characters' writer event could not be used to output text after
the document declaration, only before it or after the first XML element.
This change ensures that the document declaration will be output before
the text.  Arbitrary text can still be output at the start of the file,
if needed, by writing directly using the inner_mut method.

Addresses issue netvl#168.
  • Loading branch information
brackleian committed May 14, 2021
1 parent df46cd4 commit 1d4992f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/writer/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ impl Emitter {

pub fn emit_characters<W: Write>(&mut self, target: &mut W,
content: &str) -> Result<()> {
self.check_document_started(target)?;
self.fix_non_empty_element(target)?;
target.write(
(if self.config.perform_escaping {
Expand Down

0 comments on commit 1d4992f

Please sign in to comment.