These is the content of a file-like object toc:
<?xml version='1.0' encoding='utf-8'?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="eng">
<head>
...
</head>
<docTitle>
<text>THE_TEXT_I_WANT</text>
</docTitle>
...
</ncx>
My Python3 codes now:
import xml.etree.ElementTree as ET
# I get toc using open method in zipfile module
# toc : <zipfile.ZipExtFile name='toc.ncx' mode='r' compress_type=deflate>
toc_tree = ET.parse(toc)
for node in toc_tree.iter():
print(node)
print(toc_tree.find('docTitle'))
The for loop can print out all nodes but find method returns None. findall method returns nothing either. Please anybody tell me why? Is there any better solution?