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

Method finalize

xml/_tokenizer.ts:2577–2586  ·  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

2575 * @throws {XmlSyntaxError} If the tokenizer is in an incomplete state.
2576 */
2577 finalize(callbacks: XmlTokenCallbacks): void {
2578 this.#callbacks = callbacks;
2579 this.#flushText();
2580
2581 if (this.#state !== State.INITIAL) {
2582 // Provide specific error messages based on state
2583 const message = this.#getEndOfInputErrorMessage();
2584 this.#error(message);
2585 }
2586 }
2587
2588 #getEndOfInputErrorMessage(): string {
2589 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