Skip to content
Advertisement

Parsing XML with Pykml

I have the following xml file I got from QGIS

JavaScript

I would like to recursively substitute the value “2” in the

JavaScript

field using the information included in the “description” field REALNAME2 in order to have

JavaScript

respectively as final output in my kml

any suggestions?

Advertisement

Answer

I recommend you to use the element tree API together with XPath. It’s quite easy to use and very powerful. It will enable you to do what you want:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement