()
| 159 | } |
| 160 | |
| 161 | private readClosingTag(): void { |
| 162 | this.index += 2; |
| 163 | this.skipWhitespace(); |
| 164 | const name = this.readName(); |
| 165 | this.skipWhitespace(); |
| 166 | if (this.xml[this.index] !== '>') { |
| 167 | throw new Error(`Closing XML tag </${name}> is not closed.`); |
| 168 | } |
| 169 | this.index += 1; |
| 170 | |
| 171 | const node = this.stack.pop(); |
| 172 | if (!node) { |
| 173 | throw new Error(`Unexpected closing XML tag </${name}>.`); |
| 174 | } |
| 175 | if (node.name !== name) { |
| 176 | throw new Error(`Expected </${node.name}> before </${name}>.`); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | private readText(): void { |
| 181 | const nextTagIndex = this.xml.indexOf('<', this.index); |
no test coverage detected