all Python 3xml.etree.ElementTreefunction
xml.etree.ElementTree.fromstringlist()
parsing
Parses XML given as a sequence of string fragments and returns the root Element.
Syntax
root = ET.fromstringlist(sequence, parser=None)
Fragments may break anywhere, even in the middle of a tag: they are fed to the parser one by one through feed(), so there is no need to join them first. Still, the whole document is built in memory and the result appears only at the end; to consume data as it arrives, use XMLPullParser. Malformed markup raises ParseError, as with fromstring().
Examples
import xml.etree.ElementTree as ET
root = ET.fromstringlist(['<a><b', '>1</b>', '</a>'])
print(root[0].tag, root[0].text) # → b 1
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy