<div style="font-family: Helvetica; font-size: 13px;">Hello Noonan,<div><br></div><div>In general, I agree that docs could see improvement in listing examples. </div><div><br></div><div>Specifically what was the bug in ET object’s .findall or .find ?</div><div><br></div><div>Here I use the example listed in the docs and works fine for me.</div><div><br></div><div><div>$ ./python.exe</div><div>Python 3.4.3+ (3.4:3ded282f9615, Jun 17 2015, 06:05:20)</div><div>[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin</div><div>Type "help", "copyright", "credits" or "license" for more information.</div><div>>>> import xml.etree.ElementTree as ET</div><div>>>> tree = ET.parse('country_data.xml')</div><div>>>> root = tree.getroot()</div><div>>>> root.findall(".")</div><div>[<Element 'data' at 0x10ea87b88>]</div><div>>>> root.findall("./country/neighbor")</div><div>[<Element 'neighbor' at 0x10eb63868>, <Element 'neighbor' at 0x10eb638b8>, <Element 'neighbor' at 0x10eb63a48>, <Element 'neighbor' at 0x10eb63bd8>, <Element 'neighbor' at 0x10eb63c28>]</div><div>>>> root.findall(".//year/..[@name='Singapore']")</div><div>[<Element 'country' at 0x10eb63908>]</div><div>>>> root.findall(".//*[@name='Singapore']/year")</div><div>[<Element 'year' at 0x10eb639a8>]</div><div>>>> root.findall(".//neighbor[2]")</div><div>[<Element 'neighbor' at 0x10eb638b8>, <Element 'neighbor' at 0x10eb63c28>]</div></div><div><br></div><div><br></div><div>Thanks,</div><div>Senthil</div></div>
                <div><div><br></div><div>-- </div><div>Senthil Kumaran</div><div></div><div></div></div>
                 
                <p style="color: #A0A0A8;">On Tuesday, June 16, 2015 at 5:55 PM, Noonan wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div dir="ltr">Sorry my last email sent prematurely, I'm not sure how. I was using a hotkey for pasing when it accidently sent.<div><br></div><div>I'm running Python version:</div><div><br></div><div>3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)]<br></div><div><br></div><div>When I do a .findall or .find on an Element object of an ElementTree from xml.etree, xpath queries (of the format './/<tagname>') aren't letting me retrieve children that aren't direct descendants of the Element object. Also, the documentation doesn't clearly show/when how to use XPath queries, it just mentions that you can use them instead. A lot of python documentation is like this and it leads to a lot of tinkering and then frustration when it doesn't work. Stack overflow said the same solution, but really, I think it's sad when your documentation needs stack overflow for clarification. Documentation is by no means fast, but the depth should be better than a quick search on Google/Bing. </div><div><br></div><div>This page is the one I used to read up on it. But I actually found better depth/examples in StackOverflow or the site of the guy that I think wrote Etree before you guys integrated it into Python. </div><div><br></div><div><a href="https://docs.python.org/3/library/xml.etree.elementtree.html?highlight=xml">https://docs.python.org/3/library/xml.etree.elementtree.html?highlight=xml</a><br></div><div><br></div><div>Thanks!</div><div><br></div><div>-Eric</div><div><br></div></div>
</div><div><div>_______________________________________________</div><div>docs mailing list</div><div><a href="mailto:docs@python.org">docs@python.org</a></div><div><a href="https://mail.python.org/mailman/listinfo/docs">https://mail.python.org/mailman/listinfo/docs</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>