python:print(''.join(doc.xpath('//text()'))
Question: What is wrong? Please,somebody says me,what I have to write instead of
application/x-abiwordAbiWord.

    
    
    Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license()" for more information.
    
    >>> f=open('a.abw','r').read()
    >>> from lxml import etree
    >>> doc=etree.fromstring
    >>> from lxml import html
    >>> doc=html.fromstring
    >>> doc
    <function fromstring at 0x0113B858
    >>> print(''.join(doc.xpath('//text()'))
          application/x-abiwordAbiWord
    
    SyntaxError: invalid syntax
    


Answer: You're missing a close-paren on the print statement. Also, unless I'm
monumentally mistaken, your fromstring functions are missing parentheses and a
parameter; according to the [python
reference](http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.fromstring),
the function signature needs to be `xml.etree.ElementTree.fromstring(text)`

As it currently stands, it looks like you're assigning a reference to function
"fromstring()" to "doc". You can't call ".xpath()" on a function reference.

EDIT: Try this. EDIT 2: Tried to clarify in response to OP comment

1: paste this code into an empty document:

    
    
    MY_FILE_NAME = "path/to/my/file.abw"
    # MY_FILE_NAME = "C:\\path\\to\\my\\file.abw" ## use this on windows
    
    from lxml import etree
    from lxml import html
    import os
    
    f=open(MY_FILE_NAME,'r')
    myStr = f.read()
    f.close()
    
    doc=etree.fromstring(myStr)
    doc=html.fromstring(myStr)
    
    text = ''.join(doc.xpath('//text()'))
    
    f = open(os.environ["HOME"] + "output.txt",'w')
    f.write(text)
    f.close()
    

2: save document as recover.py

3: run the script in python

4: ???

5: profit! (aka, your story should now be in output.txt in your home
directory)

* * *

Note: **What exactly are you trying to do?** If you give us a precise
problem/task, people will be able to help you better. Also try to describe
what you have already tried - SO isn't supposed to be a place where people do
your work for free, so its important to show that you put in some effort to
solve/research your problem.

