Index: trunk/src/org/openstreetmap/josm/io/GpxWriter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 5391)
+++ trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 5393)
@@ -161,5 +161,5 @@
     private void writeTracks() {
         for (GpxTrack trk : data.tracks) {
-            open("trk");
+            openln("trk");
             writeAttr(trk.getAttributes());
             for (GpxTrackSegment seg : trk.getSegments()) {
@@ -190,5 +190,5 @@
 
     private void inline(String tag, String attributes) {
-        out.println(indent + "<" + tag + " " + attributes + " />");
+        out.println(indent + "<" + tag + " " + attributes + "/>");
     }
 
@@ -248,7 +248,12 @@
         if (pnt != null) {
             LatLon c = pnt.getCoor();
-            openAtt(type, "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + "\"");
-            writeAttr(pnt.attr);
-            closeln(type);
+            String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + "\"";
+            if (pnt.attr.isEmpty()) {
+                inline(type, coordAttr);
+            } else {
+                openAtt(type, coordAttr);
+                writeAttr(pnt.attr);
+                closeln(type);
+            }
         }
     }
