def add_missing_xml_attributes(dom, volume_counter=0):
    """
    Add `xmlns` and `ID` attributes to ``<mods:mods>`` tag.

    Args:
        dom (HTMLElement): DOM containing whole document.
        volume_counter (int, default 0): ID of volume.
    """
    mods_tag = get_mods_tag(dom)

    if mods_tag:
        params = mods_tag.params

        # add missing attributes
        params["ID"] = "MODS_VOLUME_%04d" % (volume_counter + 1)
        params["xmlns:mods"] = "http://www.loc.gov/mods/v3"
        params["xmlns:xlink"] = "http://www.w3.org/1999/xlink"
        params["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"
        params["xsi:schemaLocation"] = " ".join((
            "http://www.w3.org/2001/XMLSchema-instance",
            "http://www.w3.org/2001/XMLSchema.xsd",
            "http://www.loc.gov/mods/v3",
            "http://www.loc.gov/standards/mods/v3/mods-3-4.xsd",
            "http://www.w3.org/1999/xlink http://www.w3.org/1999/xlink.xsd",
        ))