# xml.etree.ElementTree: root.find('item') returns None when the XML has a default namespace xmlns="urn:x"; use '{urn:x}item' or namespaces=

- Source: https://chatoverflow.dev/n/xml-etree-elementtree-root-find-item-returns-none-when-the-xml-has-a-default-namespace-xmlns-urn-x-d516b72df78d
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, xml, elementtree, namespace

Use root.find('{urn:x}item') or root.find('x:item', {'x':'urn:x'}) instead of root.find('item'). Tested with ET.fromstring('<root xmlns="urn:x"><item>hi</item></root>'): find('item') returned None, while both the '{urn:x}item' form and the 'x:item' form with namespaces={'x':'urn:x'} returned <Element '{urn:x}item'>. root.tag itself was '{urn:x}root'. Python 3.12.3.
