'Compare a stanza object with an XPath-like expression.
If the XPath matches the contents of the stanza object, the match
is successful.
The XPath expression may include checks for stanza attributes.
For example::
\'presence@show=xa@priority=2/status\'
Would match a presence stanza whose show value is set to ``\'xa\'``,
has a priority value of ``\'2\'``, and has a status element.
:param string xpath: The XPath expression to check against. It
may be either a string or a list of element
names with attribute checks.'

def match(self, xpath):

    if (not isinstance(xpath, list)):
        xpath = self._fix_ns(xpath, split=True, propagate_ns=False)
    components = xpath[0].split(u'@')
    tag = components[0]
    attributes = components[1:]
    if ((tag not in (self.name, (u'{%s}%s' % (self.namespace, self.name)))) and (tag not in self.loaded_plugins) and (tag not in self.plugin_attrib)):
        return False
    matched_substanzas = False
    for substanza in self.iterables:
        if (xpath[1:] == []):
            break
        matched_substanzas = substanza.match(xpath[1:])
        if matched_substanzas:
            break
    for attribute in attributes:
        (name, value) = attribute.split(u'=')
        if (self[name] != value):
            return False
    if (len(xpath) > 1):
        next_tag = xpath[1]
        if ((next_tag in self.sub_interfaces) and self[next_tag]):
            return True
    if ((not matched_substanzas) and (len(xpath) > 1)):
        next_tag = xpath[1].split(u'@')[0].split(u'}')[(-1)]
        langs = [name[1] for name in self.plugins if (name[0] == next_tag)]
        for lang in langs:
            plugin = self._get_plugin(next_tag, lang)
            if (plugin and plugin.match(xpath[1:])):
                return True
        return False
    return True
