'Called by the XmlStream when the stream has started.
A stream is considered to have started when the start tag of the root
element has been received.
This examines C{rootElement} to see if there is a version attribute.
If absent, C{0.0} is assumed per RFC 3920. Subsequently, the
minimum of the version from the received stream header and the
value stored in L{xmlstream} is taken and put back in L{xmlstream}.
Extensions of this method can extract more information from the
stream header and perform checks on them, optionally sending
stream errors and closing the stream.'

def streamStarted(self, rootElement):

    if rootElement.hasAttribute('version'):
        version = rootElement['version'].split('.')
        try:
            version = (int(version[0]), int(version[1]))
        except (IndexError, ValueError):
            version = (0, 0)
    else:
        version = (0, 0)
    self.xmlstream.version = min(self.xmlstream.version, version)
