MCPcopy Create free account
hub / github.com/denoland/std / finalize

Method finalize

xml/_tokenizer.ts:2528–2537  ·  view source on GitHub ↗

* Finalize tokenization using callbacks. * * This method should be called after all chunks have been processed. * It flushes any pending text content and validates that the tokenizer * is in a valid end state. * * @throws {XmlSyntaxError} If the tokenizer is in an incomplete state.

(callbacks: XmlTokenCallbacks)

Source from the content-addressed store, hash-verified

2526 * @throws {XmlSyntaxError} If the tokenizer is in an incomplete state.
2527 */
2528 finalize(callbacks: XmlTokenCallbacks): void {
2529 this.#callbacks = callbacks;
2530 this.#flushText();
2531
2532 if (this.#state !== State.INITIAL) {
2533 // Provide specific error messages based on state
2534 const message = this.#getEndOfInputErrorMessage();
2535 this.#error(message);
2536 }
2537 }
2538
2539 #getEndOfInputErrorMessage(): string {
2540 switch (this.#state) {

Callers 4

collectTokensFunction · 0.95
collectChunkedTokensFunction · 0.95
collectTokensXml11Function · 0.95
collectEventsFunction · 0.95

Calls 3

#flushTextMethod · 0.95
#errorMethod · 0.95

Tested by

no test coverage detected