Skip to content

Tag: xml-parsing

Find Placemarks in kml file

I want to find all the Placemarks in a kml file: This doesn’t work, i.e. it doesn’t find anything, I think because each Placemark is unique in that each has its own id, e.g.: How do I do this? Edit: changed code based on @ScottHunter comment: length is 0 Answer It’s hard to tell without seei…

Create a DataFrame from a XML File

im new to XML and i want to know how to create a dataframe in python from this XML file. I have the following code, it creates the DataFrame but when i tried to append the value of the row, i dont know why it keeps coming “None”. I dont know if i have to change de calling argument i.e

How to replace an XML node via python

I am new in python and I have a – maybe – stupid problem with XML files (yep, I’ve tried to google the solution but without results). I have to write a program which will replace/switch two things, so first of all, here is the XML data, it looks like this: How in python i could change some_n…

xml.etree.ElementTree get node depth

The XML: The code: The output: The Xml represents a tree like structure of a sitemap. I have been up and down the docs and Google all day and can’t figure it out hot to get the node depth of entries. I used counting of the children container but that only works for the first parent and then it breaks