With ElementTree in Python 3.8, you can simply use a wildcard ({*}
) for the namespace:
results = ET.fromstring(xml).findall(".//{*}imagedata")
Note the .//
part, which means that the whole document (all descendants) is searched.
More Related Contents:
- How to parse XML and get instances of a particular node attribute?
- Parsing XML with namespace in Python via ‘ElementTree’
- Pretty printing XML in Python
- How to transform an XML file using XSLT in Python?
- Using Python Iterparse For Large XML Files
- How to convert an XML string to a dictionary?
- How do convert a pandas dataframe to XML?
- Serialize Python dictionary to XML [closed]
- How to output CDATA using ElementTree
- using lxml and iterparse() to parse a big (+- 1Gb) XML file
- Empty list returned from ElementTree findall
- How do I use a default namespace in an lxml xpath query?
- Switching into new window using Selenium after button click
- Parsing a YAML file in Python, and accessing the data?
- Convert JSON to XML in Python
- Validating with an XML schema in Python
- Parse SGML with Open Arbitrary Tags in Python 3
- Reading XML file and fetching its attributes value in Python
- Problem with newlines when I use toprettyxml()
- Simple CSV to XML Conversion – Python
- Is there a way to get a line number from an ElementTree Element
- Filling Many2many field (odoo 8)
- Comparing two xml files in python
- Parsing compressed xml feed into ElementTree
- Pretty print in lxml is failing when I add tags to a parsed tree
- Merge xml files with nested elements without external libraries
- Why is ElementTree raising a ParseError?
- How do I parse and write XML using Python’s ElementTree without moving namespaces around?
- ElementTree findall() returning empty list
- lxml: add namespace to input file