def recoverMemory(buffer, size):
    """parse an XML in-memory block and build a tree. In the case
      the document is not Well Formed, an attempt to build a tree
       is tried anyway """
    ret = libxml2mod.xmlRecoverMemory(buffer, size)
    if ret is None:raise treeError('xmlRecoverMemory() failed')
    return xmlDoc(_obj=ret)