'Substitute XML entities for special XML characters.
:param value: A string to be substituted. The less-than sign
will become &lt;, the greater-than sign will become &gt;,
and any ampersands will become &amp;. If you want ampersands
that appear to be part of an entity definition to be left
alone, use substitute_xml_containing_entities() instead.
:param make_quoted_attribute: If True, then the string will be
quoted, as befits an attribute value.'

@classmethod
def substitute_xml(cls, value, make_quoted_attribute=False):

    value = cls.AMPERSAND_OR_BRACKET.sub(cls._substitute_xml_entity, value)
    if make_quoted_attribute:
        value = cls.quoted_attribute_value(value)
    return value
