This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Eric S, eli.bendersky, martin.panter, rhettinger, scoder
Date 2015-07-31.23:11:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Eric: Calling findall("country") does _not_ return grandchidren nor further descendants. Also, your pseudocode calling findall() with no arguments does not work, so I am left wondering where you got the wrong impression about grandchildren. The usual way to get a list of direct children is to call list(parent):

>>> root = XML('''<data><country name="Leichtenstein">
...         <country name="Singapore"><country name="Panama"/></country>
...     </country></data>''')
>>> root.findall()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Required argument 'path' (pos 1) not found
>>> list(root)  # List of direct children
[<Element 'country' at 0xb6ebe324>]
>>> root.findall("country")  # List of direct <country> children
[<Element 'country' at 0xb6ebe324>]
>>> root.findall(".//country")  # List of all <country> descendants
[<Element 'country' at 0xb6ebe324>, <Element 'country' at 0xb6ebe284>, <Element 'country' at 0xb6ebe0cc>]
Date User Action Args
2015-07-31 23:11:22martin.pantersetrecipients: + martin.panter, rhettinger, scoder, eli.bendersky, Eric S
2015-07-31 23:11:22martin.pantersetmessageid: <>
2015-07-31 23:11:22martin.panterlinkissue24724 messages
2015-07-31 23:11:22martin.pantercreate