Skip to content

Commit 3fb2723

Browse files
committed
fix
1 parent 8a57cf7 commit 3fb2723

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/XMLSerializer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ public function toXML(TokenCollection $tokens): string {
3434
$writer->openMemory();
3535
$writer->setIndent(true);
3636

37+
$writer->startDocument();
3738
$this->appendToWriter($writer, $tokens);
39+
$writer->endDocument();
3840

3941
return $writer->outputMemory();
4042
}
4143

4244
public function appendToWriter(XMLWriter $writer, TokenCollection $tokens): void {
43-
$writer->startDocument();
4445
$writer->startElement('source');
4546
$writer->writeAttribute('xmlns', $this->xmlns->asString());
4647

@@ -75,6 +76,5 @@ public function appendToWriter(XMLWriter $writer, TokenCollection $tokens): void
7576
}
7677

7778
$writer->endElement();
78-
$writer->endDocument();
7979
}
8080
}

0 commit comments

Comments
 (0)