[lxml] Re: [newbie] Different ways to find elements

2021-09-04 Thread codecomplete
Thanks very much! ___ lxml - The Python XML Toolkit mailing list -- lxml@python.org To unsubscribe send an email to lxml-le...@python.org https://mail.python.org/mailman3/lists/lxml.python.org/ Member address: arch...@mail-archive.com

[lxml] Re: [newbie] Way to get tree from root?

2021-09-04 Thread codecomplete
Here's some code I found to strip namespaces after parsing, without relying on a regex: ``` # Remove namespace prefixes #Source: https://stackoverflow.com/questions/60486563/ tree = et.parse(INPUTFILE) root = tree.getroot() for elem in root.getiterator(): #ValueError: Invalid input tag of

[lxml] Re: [newbie] Different ways to find elements

2021-09-04 Thread Adrian Bool
Hi, My understanding is... xpath() The xpath function allows for complex queries based upon the XPATH standard. For example, from the following XML: Fred 34 Chris 22 Sarah 28 The following xpath query would pick out ju