| 127 | } |
| 128 | |
| 129 | private readOpeningTagEnd(): 'open' | 'self-closing' | null { |
| 130 | if (this.index >= this.xml.length) throw new Error('Opening XML tag is not closed.'); |
| 131 | if (this.xml[this.index] === '>') { |
| 132 | this.index += 1; |
| 133 | return 'open'; |
| 134 | } |
| 135 | if (this.xml[this.index] === '/' && this.xml[this.index + 1] === '>') { |
| 136 | this.index += 2; |
| 137 | return 'self-closing'; |
| 138 | } |
| 139 | return null; |
| 140 | } |
| 141 | |
| 142 | private readAttribute(): { name: string; value: string } { |
| 143 | const name = this.readRequiredName(`Invalid XML attribute at offset ${this.index}.`); |