Removing specific tags in a KML file

Posted by Legion on Stack Overflow See other posts from Stack Overflow or by Legion
Published on 2012-09-04T20:46:35Z Indexed on 2012/09/08 3:38 UTC
Read the original article Hit count: 176

Filed under:
|
|

I have a KML file which is a list of places around the world with coordinates and some other attributes. It looks like this for one place:

<Placemark>
<name>Albania - Durrës</name>
<open>0</open>
<visibility>1</visibility>
<description>(Spot ID: 275801) show <![CDATA[<a href="http://www.windguru.cz/int/index.php?go=1&vs=1&sc=275801">forecast</a>]]></description>
<styleUrl>#wgStyle001</styleUrl><Point>
<coordinates>19.489747,41.277806,0</coordinates>
</Point>
<LookAt><range>200000</range><longitude>19.489747</longitude><latitude>41.277806</latitude></LookAt>
</Placemark>

I would like to remove everything except the name of the place. So in this case that would mean I would like to remove everything except

<name>Albania - Durrës</name>

The problem is, this KML file includes more than 1000 of these places. Doing this manually obviously isn't an option, so then how can I remove all tags except for the name tags for all of the items in the list? Can I use some kind of program for that?

© Stack Overflow or respective owner

Related posts about list

Related posts about tags