def set_attribute(self, aid, attrib, val, idx='*'):
        """
        Set the value of an xml attribute marked with the matching aid attribute.
        """
        if aid in self.__attrib_ids:
            elems = self.__attrib_ids[aid]
            if idx == '*':
                for elem in elems:
                    self.__set_attribute(elem, attrib, val)
            elif idx < len(elems):
                elem = elems[idx]
                self.__set_attribute(elem, attrib, val)