I have an XML file with this format (there could be some leading spaces):    <Latitude>23.1138</Latitude>    <Longitude>8.2898</Longitude>    ...    <Latitude>19.6247</Latitude>    <Longitude>-7.3267</Longitude>    ...    <Latitude>49.4141</Latitude>    <Longitude>15.374</Longitude>Using Vim, I would like to convert each line to Cesium's KML format like this:     <Point><coordinates>15.374,49.4141</coordinates></Point>It is important to note KML puts the longitude first (contrary to every other standard). Any help would be appreciated.
Conversion from XML to KML
formatting;macro;filetype xml
I've come up with a search and replace function that should work for you::%s/\(\s*\)<Latitude>\(-\=\d\+\.\d\+\)<\/Latitude>\_.\s*<Longitude>\(-\=\d\+\.\d\+\)<\/Longitude>/\1<Point><coordinates>\3,\2<\/coordinates><\/Point>/Make sure to save your work as this command is destructive.:%s Does a search and replace over the all lines. I've swapped the two by using memory parenthesis \(\) and then using backreferences in reverse order. ie. \2\1.Edit: I've updated the function to take whitespace before the <Longitude> tags into account.