namespace Xml {

    function parse(string, options = 0) {
        output = [];
        error = $lib_xml_parse(string, output, XmlElement._DUMMY);
        if (error != null) {
            if ((options & XmlOption.FAIL_SILENTLY) != 0) return null;
            throw new Exception(error);
        }
        root = Xml._objGen(output[0], {}, options);

        if ((options & Xml.XmlOption.NAMESPACES) != 0) {
            return Xml._convertToNamespaces(root);
        }

        return root;
    }
}
