• Get the name of the root element of a XML string excluding the XML deceleration:

    <!-- Returns name of first none-comment root tag: rootTag -->
    <rootTag>
    <inner />
    </rootTag

    Parameters

    • xml: string | Buffer

      XML string or buffer

    • Optional options: {
          requireDeclaration?: boolean;
      }
      • Optional requireDeclaration?: boolean

        When true the function will return undefined when the XML string does not start with a XML declaration

    Returns undefined | string

    Name of the root tag in the XML file