def readerForDoc(cur, URL, encoding, options):
    """Create an xmltextReader for an XML in-memory document. The
      parsing flags @options are a combination of xmlParserOption. """
    ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options)
    if ret is None:raise treeError('xmlReaderForDoc() failed')
    return xmlTextReader(_obj=ret)