'Index Microsoft .docx documents'

def _index_docx(self, bin_data):

    buf = u''
    f = StringIO(bin_data)
    if zipfile.is_zipfile(f):
        try:
            zf = zipfile.ZipFile(f)
            content = xml.dom.minidom.parseString(zf.read('word/document.xml'))
            for val in ['w:p', 'w:h', 'text:list']:
                for element in content.getElementsByTagName(val):
                    buf += (textToString(element) + '\n')
        except Exception:
            pass
    return buf
