select checkbox tag python <p>If have a XML document like this :</p> <pre><code>&lt;!-- Location --&gt; &lt;w:t&gt;Lokacioni:&lt;/w:t&gt; &lt;w:t&gt;Kucni:&lt;/w:t&gt; &lt;w:t&gt;Extension:&lt;/w:t&gt; &lt;w:t&gt;Hajvali –Prishtinë&lt;/w:t&gt; &lt;w:t&gt;Rr. “ Dëshmorët e Gollakut “&lt;/w:t&gt; &lt;w:t&gt;P. N. Prishtinë&lt;/w:t&gt; &lt;!-- Date --&gt; &lt;w:t&gt;Dat:&lt;/w:t&gt; &lt;w:t&gt;Datum:&lt;/w:t&gt; &lt;w:t&gt;Date:&lt;/w:t&gt; &lt;w:t xml:space="preserve"&gt; &lt;/w:t&gt; &lt;!-- Free text - contains time and description--&gt; &lt;w:t&gt;1.&lt;/w:t&gt;&lt;w:t&gt;08:05 Aksident trafiku me dëme materiale Audi dhe Kombi te Kisha Graqanic&lt;/w:t&gt; &lt;!-- Checkboxes - 1 means it is checked --&gt; &lt;w:t&gt;Informuar:PK&lt;/w:t&gt;&lt;w:checkBox&gt;&lt;w:sizeAuto/&gt;&lt;w:default w:val="1"/&gt;&lt;/w:checkBox&gt; &lt;w:t&gt;SHME&lt;/w:t&gt;&lt;w:checkBox&gt;&lt;w:sizeAuto/&gt;&lt;w:default w:val="0"/&gt;&lt;/w:checkBox&gt; &lt;w:t&gt;SHZSH&lt;/w:t&gt;&lt;w:checkBox&gt;&lt;w:sizeAuto/&gt;&lt;w:default w:val="0"/&gt;&lt;/w:checkBox&gt; &lt;w:t&gt;,Shërbimet tjera&lt;/w:t&gt;&lt;w:checkBox&gt;&lt;w:sizeAuto/&gt;&lt;w:default w:val="0"/&gt;&lt;/w:checkBox&gt; </code></pre> <p>In python I want to select values from that xml that is generated from a .docx document, that contain checkbox. I wrote code like this:</p> <pre><code>WordNameSpace = '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}' para_tag = WordNameSpace + 'p' text_tag = WordNameSpace + 't' checkBox_tag = WordNameSpace + 'checkBox' def get_docx_text(path): document = zipfile.ZipFile(path) xml_content = document.read('word/document.xml') document.close() tree = XML(xml_content) paragraphs = [] for paragraph in tree.getiterator(checkBox_tag): texts = [node.text for node in paragraph.getiterator(text_tag) if node.text] if texts: paragraphs.append(''.join(texts)) return paragraphs results = get_docx_text('test.docx') print results </code></pre> <p>when i print results variable, result is only <code>[]</code> ? Why is this happening?</p>