Is there any way to remove the extra namespace prefix (i.e. ns2) in KML file?
This is an example of the kml I receive from my code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:kml xmlns="http://www.google.com/kml/ext/2.2" xmlns:ns2="http://www.opengis.net/kml/2.2" xmlns:ns3="http://www.w3.org/2005/Atom" xmlns:ns4="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<ns2:Placemark>
<ns2:name>London, UK</ns2:name>
<ns2:open>1</ns2:open>
<ns2:Point>
<ns2:coordinates>-0.126236,51.500152</ns2:coordinates>
</ns2:Point>
</ns2:Placemark>
</ns2:kml>
What I want is something like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Placemark>
<name>London, UK</name>
<open>true</open>
<Point>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>-0.126236,51.500152</coordinates>
</Point>
</Placemark>
</kml>
This is my java code:
final Kml kml = new Kml();
kml.createAndSetPlacemark()
.withName("London, UK").withOpen(Boolean.TRUE)
.createAndSetPoint().addToCoordinates(-0.126236, 51.500152);
//marshals to console
kml.marshal();
//marshals into file
kml.marshal(new File("output.kml"));
Any help is much appreciated! Thanks!