Transfroming annotation objects to XML
--------------------------------------

    Annotations can be easily trasformed to XML string representation:
    ------------------------------------------------------------------

    >>> from xix.utils.cover import AnnotationParser, annotationToXML

    >>> s = '''> def foo(a):
    ... !   print "hello"
    ...   # a comment'''
    >>> from xix.utils.mock import File
    >>> ant = AnnotationParser().parse(File(s))
    >>> result = annotationToXML(ant)

    Parse the result using lxml:

    >>> import lxml.etree as ET
    >>> from StringIO import StringIO
    >>> buffer = StringIO('<?xml version="1.0"?>' + result)
    >>> doc = ET.parse(buffer)
    >>> root = doc.getroot()
    >>> print root.tag
    coverageAnnotation
    >>> for node in root.getchildren():
    ...    print node.tag, node.attrib['executable'], node.attrib['covered']
    ...    print 'Text:', node.text
    ...
    line true true
    Text: def foo(a):
    line true false
    Text:   print "hello"
    line false false
    Text: # a comment

    The ElementTree object can be returned directly by setting the "tree"
    argument to True:

    >>> t = annotationToXML(ant, tree=True)
    >>> print t.getroot().tag
    coverageAnnotation


