I have this XML file and I want to get the country nodes which have the pattern 'in' in their name.
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
</country>
<country name="Singapore">
<rank>4</rank>
<year>2011</year>
<gdppc>59900</gdppc>
<neighbor name="Malaysia" direction="N"/>
</country>
<country name="Panama">
<rank>68</rank>
<year>2011</year>
<gdppc>13600</gdppc>
<neighbor name="Costa Rica" direction="W"/>
<neighbor name="Colombia" direction="E"/>
</country>
</data>
I have tried this
import xml.etree.ElementTree as ET
tree = ET.parse('test.xml')
root = tree.getroot()
list=root.find(".//country[contains(@name, 'Pana')]")
But I am getting an error : SyntaxError: invalid predicate
Could anyone please help how to solve this?