Skip to content

Commit 9001c35

Browse files
committed
handle empty elements correctly
1 parent e0c9af7 commit 9001c35

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Tokenizer/XmlReaderTokenizer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public function tokenize(): Generator
5050
$element->depth = ++$this->depth;
5151
$this->renderAttributes($element);
5252

53+
if ($this->reader->isEmptyElement) {
54+
$this->depth--;
55+
}
56+
5357
yield $element;
5458
} elseif ($this->reader->nodeType === XMLReader::TEXT) {
5559
$text = new Text($this->reader->value, ($this->flags & self::XML_USE_CDATA));

0 commit comments

Comments
 (0)