def METHOD_NAME(app, exception):
    """Generates the sitemap.xml from the collected HTML page links"""
    filename = app.outdir + "/sitemap-docs.xml"
    print("Generating sitemap-docs.xml in %s" % filename)
    root = ET.Element("urlset")
    root.set("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9")
    for link in app.sitemap_links:
        url = ET.SubElement(root, "url")
        ET.SubElement(url, "loc").text = html_baseurl + link
    ET.ElementTree(root).write(filename)