Function parseXml

  • This is my preferred way to parse an XML document. Any and all errors result in undefined. See testXml() if you need better error messages.

    Parameters

    • bytes: undefined | string

      The input as a string.

      If the input is undefined, immediately return undefined. This makes it easy to propagate errors and only check for undefined once, at the end.

    Returns Element | undefined

    The root element of the resulting XML Document, or undefined in case of any errors.