• Beta

    Parse XML into a JS object with no validation and some failure tolerance

    Parameters

    • input: string

      The input XML string

    • options: XmlParseOptions = {}

      Optional parsing options

    Returns XmlNode

    The parsed XML

    const obj = parseXml('<root><child>text</child></root>');

    assert(obj.childNodes[0].nodeName === 'root');
    assert(obj.childNodes[0].childNodes[0].nodeName === 'child');
    assert(obj.childNodes[0].childNodes[0].childNodes[0].nodeValue === 'text');