def add_xml_names_to_robots(robots, xml_file):
    """Add robots from "Data for UASparser" in XML format to robots set."""
    dom = parse(xml_file)
    user_agents = list()
    for robot in dom.getElementsByTagName("robot"):
        for node in robot.childNodes:
            if node.localName == "family":
                family = node.firstChild.data.strip()
            if node.localName == "name":
                name = node.firstChild.data.strip()
            if node.localName == "useragent":
                user_agents.append(node.firstChild.data.strip())
        # Use the family title instead of the name, if it is long enough
        if 3 > len(family):
            name = family
        # Remove trailing versions (length protected in regex)
        name_new = re_trailing_version.search(name)
        if name_new:
            name = name_new.group("robot")
        if name.endswith(" b"):
            name = name.rstrip(" b")
        robots.add(name.strip())
    return robots, sorted(user_agents)
dataset/ETHPy150Open ClockworkNet/wtop/robots/create_robots_resources.py/add_xml_names_to_robots/swapped operands of `>`