(
name: string,
line: number,
column: number,
offset: number,
)
| 193 | // XmlTokenCallbacks implementation |
| 194 | |
| 195 | onStartTagOpen( |
| 196 | name: string, |
| 197 | line: number, |
| 198 | column: number, |
| 199 | offset: number, |
| 200 | ): void { |
| 201 | const colonIndex = name.indexOf(":"); |
| 202 | |
| 203 | // Validate QName syntax (Namespaces §3) |
| 204 | const qnameError = validateQName(name, colonIndex); |
| 205 | if (qnameError) { |
| 206 | throw new XmlSyntaxError( |
| 207 | `Invalid element name '${name}': ${qnameError}`, |
| 208 | { line, column, offset }, |
| 209 | ); |
| 210 | } |
| 211 | |
| 212 | // Elements cannot use xmlns prefix (Namespaces 1.0 errata NE08) |
| 213 | if (colonIndex !== -1 && name.startsWith("xmlns:")) { |
| 214 | throw new XmlSyntaxError( |
| 215 | "Element name cannot use the 'xmlns' prefix", |
| 216 | { line, column, offset }, |
| 217 | ); |
| 218 | } |
| 219 | |
| 220 | this.#pendingName = name; |
| 221 | this.#pendingColonIndex = colonIndex; |
| 222 | this.#pendingLine = line; |
| 223 | this.#pendingColumn = column; |
| 224 | this.#pendingOffset = offset; |
| 225 | this.#hasPendingElement = true; |
| 226 | this.#attrIterator._reset(); |
| 227 | this.#pendingNsBindings.length = 0; // Reset for new element |
| 228 | } |
| 229 | |
| 230 | onAttribute(name: string, value: string): void { |
| 231 | if (this.#hasPendingElement) { |
nothing calls this directly
no test coverage detected