UNPKG

libxml2-wasm

Version:

WebAssembly-based libxml2 javascript wrapper

57 lines (56 loc) 2.08 kB
import { XmlDocument } from './document.mjs'; import { ErrorDetail, XmlLibError } from './libxml2.mjs'; import { XmlDisposable } from './disposable.mjs'; /** * The exception that is thrown when validating XML against a schema. */ export declare class XmlValidateError extends XmlLibError { static fromDetails(details: ErrorDetail[]): XmlValidateError; } export declare class DtdValidator { } /** * The RelaxNG schema validator. * * Note: This validator must be disposed explicitly. */ export declare class RelaxNGValidator extends XmlDisposable<RelaxNGValidator> { /** * Validate the XmlDocument. * * @param doc The XmlDocument to be validated. * @throws an {@link XmlValidateError} if the document is invalid; * @throws an {@link XmlError} or {@link XmlValidateError} if there’s an error, * such as validating a document that’s already disposed, etc. */ validate(doc: XmlDocument): void; /** * Creates a RelaxNGValidator instance from an XmlDocument. * @param rng The XmlDocument representing the RelaxNG schema * @throws an {@link XmlError} or {@link XmlValidateError} if something goes wrong. */ static fromDoc(rng: XmlDocument): RelaxNGValidator; } /** * The XSD schema validator. * * Note: This validator must to be disposed explicitly. */ export declare class XsdValidator extends XmlDisposable<XsdValidator> { /** * Validate the XmlDocument. * * @param doc The XmlDocument to be validated. * @throws an {@link XmlValidateError} if the document is invalid; * @throws an {@link XmlError} or {@link XmlValidateError} if there's an error, * such as validating a document that's already disposed, etc. */ validate(doc: XmlDocument): void; /** * Create an XsdValidator instance from an {@link XmlDocument} object. * * @param xsd The XSD schema, parsed in to an XmlDocument object. * @throws an {@link XmlError} or {@link XmlValidateError} if something goes wrong. */ static fromDoc(xsd: XmlDocument): XsdValidator; }