title: How to mark multiple coordinates in KML using Java?
body: <p>I'm working on a project that involves KML creation using Java. Currently, I'm fooling with the sample Java code from the KML example at <a href="http://labs.micromata.de/display/jak/HelloKML+(Quickstart)" rel="nofollow">Micromata Labs JAK Example</a>. I tried to "extend" the code by adding multiple coordinates and getting two markers, but I could not get it to work. Can you please tell me how I can add multiple coordinates and put markers on them, and also, draw a line between the markers. Thank you for your help!</p>
  
  <p>PS: I need to do this via the program. I saw sample code of them using DOM and XML, but not pure Java/JAK as such. Please guide me.</p>
  
  <p>I got as far as this (updated):</p>
  
  <pre><code>kml.createAndSetDocument().withName("MyMarkers")
  .createAndAddPlacemark().withName("London, UK").withOpen(Boolean.TRUE)  
  .createAndSetPoint().addToCoordinates(-0.126236, 51.500152);    
  
  kml.createAndSetDocument().withName("MyMarkers")  
  .createAndAddPlacemark().withName("Somewhere near London,UK").withOpen(Boolean.TRUE)
  .createAndSetPoint().addToCoordinates(-0.129800,52.70‌​0152);
  </code></pre>
  
  <p>But I know I'm going wrong somewhere. Please point me in the right direction.</p>
  
  <p>Here is the resulting KML output:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"&gt;
  &lt;Document&gt;
      &lt;name&gt;MyMarkers&lt;/name&gt;
      &lt;Placemark&gt;
          &lt;name&gt;Somewhere near London, UK&lt;/name&gt;
          &lt;open&gt;1&lt;/open&gt;
          &lt;Point&gt;
              &lt;coordinates&gt;-0.1298,52.700152&lt;/coordinates&gt;
          &lt;/Point&gt;
      &lt;/Placemark&gt;
  &lt;/Document&gt;
  &lt;/kml&gt;
  </code></pre>
  
  <p>I can't seem to access the Document again to add more placemarks. How do I do it?</p>