def parseMemory(buffer, size):
    """parse an XML in-memory block and build a tree. """
    ret = libxml2mod.xmlParseMemory(buffer, size)
    if ret is None:raise parserError('xmlParseMemory() failed')
    return xmlDoc(_obj=ret)