Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/ogone/src/ogone.dom.d.ts>DOMParser

Advanced Web Composition for Future
Latest
interface DOMParser
import { type DOMParser } from "https://deno.land/x/ogone@revb3/src/ogone.dom.d.ts";

Provides the ability to parse XML or HTML source code from a string into a DOM Document.

Methods

parseFromString(string: string, type: DOMParserSupportedType): Document

Parses string using either the HTML or XML parser, according to export type, and returns the resulting Document. export type can be "text/html" (which will invoke the HTML parser), or any of "text/xml", "application/xml", "application/xhtml+xml", or "image/svg+xml" (which will invoke the XML parser).

For the XML parser, if string cannot be parsed, then the returned Document will contain elements describing the resulting error.

Note that script elements are not evaluated during parsing, and the resulting document's encoding will always be UTF-8.

Values other than the above for export type will cause a TypeError exception to be thrown.