libxslt-wasm
Version:
JavaScript bindings for libxslt compiled to WebAssembly
48 lines (47 loc) • 1.79 kB
TypeScript
import { XmlOutputBuffer } from "./XmlOutputBuffer.ts";
import { DataSegment } from "../common/DataSegment.ts";
import type { Encoding } from "../interfaces.ts";
import { type XmlOption } from "../utils/parseXmlOptions.ts";
type XmlDocumentBaseOptions = {
encoding?: Encoding;
options?: Partial<Record<XmlOption, boolean>>;
};
/**
* A wrapper class for `xmlDocPtr` in libxml2
*/
declare class XmlDocument extends DataSegment {
static fromUrl(url: string, { encoding, options }?: XmlDocumentBaseOptions): Promise<XmlDocument>;
static fromString(xmlString: string, { encoding, url, options }?: XmlDocumentBaseOptions & {
url?: string;
}): Promise<XmlDocument>;
static fromBuffer(buffer: ArrayBufferLike, options: Parameters<typeof this.from>[1]): Promise<XmlDocument>;
static from(buffer: Uint8Array, { url, encoding, options }?: XmlDocumentBaseOptions & {
url?: string;
}): Promise<XmlDocument>;
delete(): void;
/**
* Formats the XML document as a string by dumping the XML tree to an
* {@link XmlOutputBuffer} and returning its string representation.
*/
toString(options?: {
format?: boolean;
encoding?: Encoding;
}): string;
/**
* Assuming the document is an HTML tree, dumps the document to an
* {@link XmlOutputBuffer} and returns the output buffer
*/
toHtmlOutputBuffer(options?: {
format?: boolean;
encoding?: Encoding;
}): XmlOutputBuffer;
/**
* Assuming the document is an HTML tree, serializes the document via
* {@link toHtmlOutputBuffer} and returns the string
*/
toHtmlString(options?: {
format?: boolean;
encoding?: Encoding;
}): string;
}
export { type XmlDocumentBaseOptions, XmlDocument };