@classmethod
def _substitute_xml_entity(cls, matchobj):
    """Used with a regular expression to substitute the
        appropriate XML entity for a special character."""
    entity = cls.CHARACTER_TO_XML_ENTITY[matchobj.group(0)]
    return '&%s;' % entity
