'Convert the rule into XML string representation.'

def to_xml(self):

    s = [(('<' + RULE) + '>')]
    s.append((('<' + ACTION) + '>'))
    if self.action_text:
        s.extend([(('<' + self.action) + '>'), self.action_text, (('</' + self.action) + '>')])
    else:
        s.append((('<' + self.action) + '/>'))
    s.append((('</' + ACTION) + '>'))
    s.append((('<' + CONDITION) + '>'))
    for condition_name in self.conditions:
        if (condition_name not in LEGAL_CONDITIONS):
            continue
        if (condition_name in LEGAL_REPEATABLE_CONDITIONS):
            condition_values = self.conditions[condition_name]
        else:
            condition_values = [self.conditions[condition_name]]
        for condition_value in condition_values:
            s.extend([(('<' + condition_name) + '>'), condition_value, (('</' + condition_name) + '>')])
    s.append((('</' + CONDITION) + '>'))
    s.append((('</' + RULE) + '>'))
    return ''.join(s)
