UNPKG

lit-xml

Version:

Burning your XML documents to the ground? Yes please. In the mean time, let's use lit-xml.

10 lines (8 loc) 336 B
import { XMLValidator } from 'fast-xml-parser'; import { InvalidXmlError } from './invalid-xml-error.js'; export function isWellFormed(xml: string) { const validationResult = XMLValidator.validate(xml); if (validationResult !== true) { throw new InvalidXmlError(validationResult.err.line, validationResult.err.msg, xml); } }