I am trying to replace the element inside of bbox with a new set of coordinates.
my code :
# import element tree
import xml.etree.ElementTree as ET
#import xml file
tree = ET.parse('C:/highway.xml')
root = tree.getroot()
#replace bounding box with new coordinates
elem = tree.findall('bbox')
elem.txt = '40.5,41.5,-12.0,-1.2'
my xml file:
<geoEtl>
<source>
<server>localhost</server>
<port>xxxx</port>
<db>vxxx</db>
<user>xxxx</user>
<passwd>xxxx</passwd>
</source>
<targetDir>/home/firstuser/</targetDir>
<bbox>-52.50,-1.9,52.45,-1.85</bbox>
<extractions>
<extraction>
<table>geo_db_roads</table>
<outputName>highways</outputName>
<filter>highway = 'motorway'</filter>
<geometry>way</geometry>
<fields>
<field>name</field>
</fields>
</extraction>
</extractions>
</geoEtl>
have tried a variety of ways to do of things i found here but it doesnt seem to be working. thanks.
The error I'm receiving is as follows:
line 20, in <module> elem.txt = '40.5,41.5,-12.0,-1.2' AttributeError: 'list' object has no attribute 'txt' –