I want to remove all Placemarks from a KML file that contain the element
<tessellate>. The following block should be wholly removed:
<Placemark> <styleUrl>#m_ylw-pushpin330</styleUrl> <LineString> <tessellate>1</tessellate> <coordinates> 0.0000000000000,0.0000000000000,0 0.0000000000000,0.0000000000000,0 </coordinates> </LineString> </Placemark>
I have tried some non-greedy perl regex with no luck (a lot of stuff is removed together with the first
sed -r ':a; N; $!ba; s/\n\t*//g' myplaces.kml | perl -pe 's|<Placemark>.*?<tessellate>.*?</Placemark>||g'
I believe a XML parser is the way to go, but I read the documentation for xmlstarlet and got nowhere. So any solutions in xmlstarlet, python, etc. are also welcome!