Index: /trunk/src/org/openstreetmap/josm/data/gpx/Extensions.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/gpx/Extensions.java	(revision 5679)
+++ /trunk/src/org/openstreetmap/josm/data/gpx/Extensions.java	(revision 5679)
@@ -0,0 +1,18 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.gpx;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Data class for extensions in a GPX-File.
+ */
+public class Extensions extends LinkedHashMap<String, String> {
+
+    public Extensions(Map<? extends String, ? extends String> m) {
+        super(m);
+    }
+
+    public Extensions() {
+    }
+}
Index: /trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java	(revision 5679)
@@ -31,4 +31,7 @@
     public static final String META_NAME = META_PREFIX + "name";
     public static final String META_TIME = META_PREFIX + "time";
+    public static final String META_EXTENSIONS = META_PREFIX + "extensions";
+
+    public static final String JOSM_EXTENSIONS_NAMESPACE_URI = "http://josm.openstreetmap.de/gpx-extensions";
 
     public File storageFile;
Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 5679)
@@ -178,5 +178,5 @@
                     GpxReader reader = new GpxReader(iStream);
                     reader.parse(false);
-                    data = reader.data;
+                    data = reader.getGpxData();
                     data.storageFile = sel;
 
Index: /trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java	(revision 5679)
@@ -44,5 +44,5 @@
             GpxReader reader = new GpxReader(in);
             gpxParsedProperly = reader.parse(false);
-            GpxData currentGpx = reader.data;
+            GpxData currentGpx = reader.getGpxData();
             if (result == null) {
                 result = currentGpx;
Index: /trunk/src/org/openstreetmap/josm/io/GpxImporter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxImporter.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/io/GpxImporter.java	(revision 5679)
@@ -89,6 +89,6 @@
             GpxReader r = new GpxReader(is);
             boolean parsedProperly = r.parse(true);
-            r.data.storageFile = file;
-            addLayers(loadLayers(r.data, parsedProperly, fileName, tr("Markers from {0}", fileName)));
+            r.getGpxData().storageFile = file;
+            addLayers(loadLayers(r.getGpxData(), parsedProperly, fileName, tr("Markers from {0}", fileName)));
         } catch (SAXException e) {
             e.printStackTrace();
@@ -163,6 +163,6 @@
             final GpxReader r = new GpxReader(is);
             final boolean parsedProperly = r.parse(true);
-            r.data.storageFile = associatedFile;
-            return loadLayers(r.data, parsedProperly, gpxLayerName, markerLayerName);
+            r.getGpxData().storageFile = associatedFile;
+            return loadLayers(r.getGpxData(), parsedProperly, gpxLayerName, markerLayerName);
         } catch (SAXException e) {
             e.printStackTrace();
Index: /trunk/src/org/openstreetmap/josm/io/GpxReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxReader.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/io/GpxReader.java	(revision 5679)
@@ -20,4 +20,5 @@
 
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.gpx.Extensions;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.data.gpx.GpxLink;
@@ -44,5 +45,5 @@
      * The resulting gpx data
      */
-    public GpxData data;
+    private GpxData gpxData;
     private enum State { init, gpx, metadata, wpt, rte, trk, ext, author, link, trkseg, copyright}
     private InputSource inputSource;
@@ -50,5 +51,5 @@
     private class Parser extends DefaultHandler {
 
-        private GpxData currentData;
+        private GpxData data;
         private Collection<Collection<WayPoint>> currentTrack;
         private Map<String, Object> currentTrackAttr;
@@ -60,4 +61,5 @@
 
         private GpxLink currentLink;
+        private Extensions currentExtensions;
         private Stack<State> states;
         private final Stack<String> elements = new Stack<String>();
@@ -70,5 +72,5 @@
             accumulator = new StringBuffer();
             states = new Stack<State>();
-            currentData = new GpxData();
+            data = new GpxData();
         }
 
@@ -88,10 +90,10 @@
 
         @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
-            elements.push(qName);
+            elements.push(localName);
             switch(currentState) {
             case init:
                 states.push(currentState);
                 currentState = State.gpx;
-                currentData.creator = atts.getValue("creator");
+                data.creator = atts.getValue("creator");
                 version = atts.getValue("version");
                 if (version != null && version.startsWith("1.0")) {
@@ -103,39 +105,41 @@
                 break;
             case gpx:
-                if (qName.equals("metadata")) {
+                if (localName.equals("metadata")) {
                     states.push(currentState);
                     currentState = State.metadata;
-                } else if (qName.equals("wpt")) {
+                } else if (localName.equals("wpt")) {
                     states.push(currentState);
                     currentState = State.wpt;
                     currentWayPoint = new WayPoint(parseLatLon(atts));
-                } else if (qName.equals("rte")) {
+                } else if (localName.equals("rte")) {
                     states.push(currentState);
                     currentState = State.rte;
                     currentRoute = new GpxRoute();
-                } else if (qName.equals("trk")) {
+                } else if (localName.equals("trk")) {
                     states.push(currentState);
                     currentState = State.trk;
                     currentTrack = new ArrayList<Collection<WayPoint>>();
                     currentTrackAttr = new HashMap<String, Object>();
-                } else if (qName.equals("extensions")) {
+                } else if (localName.equals("extensions")) {
                     states.push(currentState);
                     currentState = State.ext;
-                } else if (qName.equals("gpx") && atts.getValue("creator") != null && atts.getValue("creator").startsWith("Nokia Sports Tracker")) {
+                    currentExtensions = new Extensions();
+                } else if (localName.equals("gpx") && atts.getValue("creator") != null && atts.getValue("creator").startsWith("Nokia Sports Tracker")) {
                     nokiaSportsTrackerBug = true;
                 }
                 break;
             case metadata:
-                if (qName.equals("author")) {
+                if (localName.equals("author")) {
                     states.push(currentState);
                     currentState = State.author;
-                } else if (qName.equals("extensions")) {
+                } else if (localName.equals("extensions")) {
                     states.push(currentState);
                     currentState = State.ext;
-                } else if (qName.equals("copyright")) {
+                    currentExtensions = new Extensions();
+                } else if (localName.equals("copyright")) {
                     states.push(currentState);
                     currentState = State.copyright;
-                    currentData.attr.put(GpxData.META_COPYRIGHT_AUTHOR, atts.getValue("author"));
-                } else if (qName.equals("link")) {
+                    data.attr.put(GpxData.META_COPYRIGHT_AUTHOR, atts.getValue("author"));
+                } else if (localName.equals("link")) {
                     states.push(currentState);
                     currentState = State.link;
@@ -144,28 +148,29 @@
                 break;
             case author:
-                if (qName.equals("link")) {
+                if (localName.equals("link")) {
                     states.push(currentState);
                     currentState = State.link;
                     currentLink = new GpxLink(atts.getValue("href"));
-                } else if (qName.equals("email")) {
-                    currentData.attr.put(GpxData.META_AUTHOR_EMAIL, atts.getValue("id") + "@" + atts.getValue("domain"));
+                } else if (localName.equals("email")) {
+                    data.attr.put(GpxData.META_AUTHOR_EMAIL, atts.getValue("id") + "@" + atts.getValue("domain"));
                 }
                 break;
             case trk:
-                if (qName.equals("trkseg")) {
+                if (localName.equals("trkseg")) {
                     states.push(currentState);
                     currentState = State.trkseg;
                     currentTrackSeg = new ArrayList<WayPoint>();
-                } else if (qName.equals("link")) {
+                } else if (localName.equals("link")) {
                     states.push(currentState);
                     currentState = State.link;
                     currentLink = new GpxLink(atts.getValue("href"));
-                } else if (qName.equals("extensions")) {
+                } else if (localName.equals("extensions")) {
                     states.push(currentState);
                     currentState = State.ext;
+                    currentExtensions = new Extensions();
                 }
                 break;
             case trkseg:
-                if (qName.equals("trkpt")) {
+                if (localName.equals("trkpt")) {
                     states.push(currentState);
                     currentState = State.wpt;
@@ -174,28 +179,29 @@
                 break;
             case wpt:
-                if (qName.equals("link")) {
+                if (localName.equals("link")) {
                     states.push(currentState);
                     currentState = State.link;
                     currentLink = new GpxLink(atts.getValue("href"));
-                } else if (qName.equals("extensions")) {
+                } else if (localName.equals("extensions")) {
                     states.push(currentState);
                     currentState = State.ext;
+                    currentExtensions = new Extensions();
                 }
                 break;
             case rte:
-                if (qName.equals("link")) {
+                if (localName.equals("link")) {
                     states.push(currentState);
                     currentState = State.link;
                     currentLink = new GpxLink(atts.getValue("href"));
-                } else if (qName.equals("rtept")) {
+                } else if (localName.equals("rtept")) {
                     states.push(currentState);
                     currentState = State.wpt;
                     currentWayPoint = new WayPoint(parseLatLon(atts));
-                } else if (qName.equals("extensions")) {
+                } else if (localName.equals("extensions")) {
                     states.push(currentState);
                     currentState = State.ext;
-                }
-                break;
-            default:
+                    currentExtensions = new Extensions();
+                }
+                break;
             }
             accumulator.setLength(0);
@@ -223,5 +229,5 @@
             switch (currentState) {
             case rte: return currentRoute.attr;
-            case metadata: return currentData.attr;
+            case metadata: return data.attr;
             case wpt: return currentWayPoint.attr;
             case trk: return currentTrackAttr;
@@ -236,22 +242,25 @@
             case gpx:       // GPX 1.0
             case metadata:  // GPX 1.1
-                if (qName.equals("name")) {
-                    currentData.attr.put(GpxData.META_NAME, accumulator.toString());
-                } else if (qName.equals("desc")) {
-                    currentData.attr.put(GpxData.META_DESC, accumulator.toString());
-                } else if (qName.equals("time")) {
-                    currentData.attr.put(GpxData.META_TIME, accumulator.toString());
-                } else if (qName.equals("keywords")) {
-                    currentData.attr.put(GpxData.META_KEYWORDS, accumulator.toString());
-                } else if (version.equals("1.0") && qName.equals("author")) {
+                if (localName.equals("name")) {
+                    data.attr.put(GpxData.META_NAME, accumulator.toString());
+                } else if (localName.equals("desc")) {
+                    data.attr.put(GpxData.META_DESC, accumulator.toString());
+                } else if (localName.equals("time")) {
+                    data.attr.put(GpxData.META_TIME, accumulator.toString());
+                } else if (localName.equals("keywords")) {
+                    data.attr.put(GpxData.META_KEYWORDS, accumulator.toString());
+                } else if (version.equals("1.0") && localName.equals("author")) {
                     // author is a string in 1.0, but complex element in 1.1
-                    currentData.attr.put(GpxData.META_AUTHOR_NAME, accumulator.toString());
-                } else if (version.equals("1.0") && qName.equals("email")) {
-                    currentData.attr.put(GpxData.META_AUTHOR_EMAIL, accumulator.toString());
-                } else if (qName.equals("url") || qName.equals("urlname")) {
-                    currentData.attr.put(qName, accumulator.toString());
-                } else if ((currentState == State.metadata && qName.equals("metadata")) ||
-                        (currentState == State.gpx && qName.equals("gpx"))) {
-                    convertUrlToLink(currentData.attr);
+                    data.attr.put(GpxData.META_AUTHOR_NAME, accumulator.toString());
+                } else if (version.equals("1.0") && localName.equals("email")) {
+                    data.attr.put(GpxData.META_AUTHOR_EMAIL, accumulator.toString());
+                } else if (localName.equals("url") || localName.equals("urlname")) {
+                    data.attr.put(localName, accumulator.toString());
+                } else if ((currentState == State.metadata && localName.equals("metadata")) ||
+                        (currentState == State.gpx && localName.equals("gpx"))) {
+                    convertUrlToLink(data.attr);
+                    if (currentExtensions != null && !currentExtensions.isEmpty()) {
+                        data.attr.put(GpxData.META_EXTENSIONS, currentExtensions);
+                    }
                     currentState = states.pop();
                 }
@@ -259,29 +268,29 @@
                 break;
             case author:
-                if (qName.equals("author")) {
-                    currentState = states.pop();
-                } else if (qName.equals("name")) {
-                    currentData.attr.put(GpxData.META_AUTHOR_NAME, accumulator.toString());
-                } else if (qName.equals("email")) {
+                if (localName.equals("author")) {
+                    currentState = states.pop();
+                } else if (localName.equals("name")) {
+                    data.attr.put(GpxData.META_AUTHOR_NAME, accumulator.toString());
+                } else if (localName.equals("email")) {
                     // do nothing, has been parsed on startElement
-                } else if (qName.equals("link")) {
-                    currentData.attr.put(GpxData.META_AUTHOR_LINK, currentLink);
+                } else if (localName.equals("link")) {
+                    data.attr.put(GpxData.META_AUTHOR_LINK, currentLink);
                 }
                 break;
             case copyright:
-                if (qName.equals("copyright")) {
-                    currentState = states.pop();
-                } else if (qName.equals("year")) {
-                    currentData.attr.put(GpxData.META_COPYRIGHT_YEAR, accumulator.toString());
-                } else if (qName.equals("license")) {
-                    currentData.attr.put(GpxData.META_COPYRIGHT_LICENSE, accumulator.toString());
+                if (localName.equals("copyright")) {
+                    currentState = states.pop();
+                } else if (localName.equals("year")) {
+                    data.attr.put(GpxData.META_COPYRIGHT_YEAR, accumulator.toString());
+                } else if (localName.equals("license")) {
+                    data.attr.put(GpxData.META_COPYRIGHT_LICENSE, accumulator.toString());
                 }
                 break;
             case link:
-                if (qName.equals("text")) {
+                if (localName.equals("text")) {
                     currentLink.text = accumulator.toString();
-                } else if (qName.equals("type")) {
+                } else if (localName.equals("type")) {
                     currentLink.type = accumulator.toString();
-                } else if (qName.equals("link")) {
+                } else if (localName.equals("link")) {
                     if (currentLink.uri == null && accumulator != null && accumulator.toString().length() != 0) {
                         currentLink = new GpxLink(accumulator.toString());
@@ -290,5 +299,5 @@
                 }
                 if (currentState == State.author) {
-                    currentData.attr.put(GpxData.META_AUTHOR_LINK, currentLink);
+                    data.attr.put(GpxData.META_AUTHOR_LINK, currentLink);
                 } else if (currentState != State.link) {
                     Map<String, Object> attr = getAttr();
@@ -300,39 +309,39 @@
                 break;
             case wpt:
-                if (   qName.equals("ele")  || qName.equals("magvar")
-                        || qName.equals("name") || qName.equals("src")
-                        || qName.equals("geoidheight") || qName.equals("type")
-                        || qName.equals("sym") || qName.equals("url")
-                        || qName.equals("urlname")) {
-                    currentWayPoint.attr.put(qName, accumulator.toString());
-                } else if(qName.equals("hdop") || qName.equals("vdop") ||
-                        qName.equals("pdop")) {
+                if (   localName.equals("ele")  || localName.equals("magvar")
+                        || localName.equals("name") || localName.equals("src")
+                        || localName.equals("geoidheight") || localName.equals("type")
+                        || localName.equals("sym") || localName.equals("url")
+                        || localName.equals("urlname")) {
+                    currentWayPoint.attr.put(localName, accumulator.toString());
+                } else if(localName.equals("hdop") || localName.equals("vdop") ||
+                        localName.equals("pdop")) {
                     try {
-                        currentWayPoint.attr.put(qName, Float.parseFloat(accumulator.toString()));
+                        currentWayPoint.attr.put(localName, Float.parseFloat(accumulator.toString()));
                     } catch(Exception e) {
-                        currentWayPoint.attr.put(qName, new Float(0));
+                        currentWayPoint.attr.put(localName, new Float(0));
                     }
-                } else if (qName.equals("time")) {
-                    currentWayPoint.attr.put(qName, accumulator.toString());
+                } else if (localName.equals("time")) {
+                    currentWayPoint.attr.put(localName, accumulator.toString());
                     currentWayPoint.setTime();
-                } else if (qName.equals("cmt") || qName.equals("desc")) {
-                    currentWayPoint.attr.put(qName, accumulator.toString());
+                } else if (localName.equals("cmt") || localName.equals("desc")) {
+                    currentWayPoint.attr.put(localName, accumulator.toString());
                     currentWayPoint.setTime();
-                } else if (qName.equals("rtept")) {
+                } else if (localName.equals("rtept")) {
                     currentState = states.pop();
                     convertUrlToLink(currentWayPoint.attr);
                     currentRoute.routePoints.add(currentWayPoint);
-                } else if (qName.equals("trkpt")) {
+                } else if (localName.equals("trkpt")) {
                     currentState = states.pop();
                     convertUrlToLink(currentWayPoint.attr);
                     currentTrackSeg.add(currentWayPoint);
-                } else if (qName.equals("wpt")) {
+                } else if (localName.equals("wpt")) {
                     currentState = states.pop();
                     convertUrlToLink(currentWayPoint.attr);
-                    currentData.waypoints.add(currentWayPoint);
+                    data.waypoints.add(currentWayPoint);
                 }
                 break;
             case trkseg:
-                if (qName.equals("trkseg")) {
+                if (localName.equals("trkseg")) {
                     currentState = states.pop();
                     currentTrack.add(currentTrackSeg);
@@ -340,27 +349,30 @@
                 break;
             case trk:
-                if (qName.equals("trk")) {
+                if (localName.equals("trk")) {
                     currentState = states.pop();
                     convertUrlToLink(currentTrackAttr);
-                    currentData.tracks.add(new ImmutableGpxTrack(currentTrack, currentTrackAttr));
-                } else if (qName.equals("name") || qName.equals("cmt")
-                        || qName.equals("desc") || qName.equals("src")
-                        || qName.equals("type") || qName.equals("number")
-                        || qName.equals("url") || qName.equals("urlname")) {
-                    currentTrackAttr.put(qName, accumulator.toString());
+                    data.tracks.add(new ImmutableGpxTrack(currentTrack, currentTrackAttr));
+                } else if (localName.equals("name") || localName.equals("cmt")
+                        || localName.equals("desc") || localName.equals("src")
+                        || localName.equals("type") || localName.equals("number")
+                        || localName.equals("url") || localName.equals("urlname")) {
+                    currentTrackAttr.put(localName, accumulator.toString());
                 }
                 break;
             case ext:
-                if (qName.equals("extensions")) {
-                    currentState = states.pop();
+                if (localName.equals("extensions")) {
+                    currentState = states.pop();
+                // only interested in extensions written by JOSM
+                } else if (GpxData.JOSM_EXTENSIONS_NAMESPACE_URI.equals(namespaceURI)) {
+                    currentExtensions.put(localName, accumulator.toString());
                 }
                 break;
             default:
-                if (qName.equals("wpt")) {
-                    currentState = states.pop();
-                } else if (qName.equals("rte")) {
+                if (localName.equals("wpt")) {
+                    currentState = states.pop();
+                } else if (localName.equals("rte")) {
                     currentState = states.pop();
                     convertUrlToLink(currentRoute.attr);
-                    currentData.routes.add(currentRoute);
+                    data.routes.add(currentRoute);
                 }
             }
@@ -370,5 +382,9 @@
             if (!states.empty())
                 throw new SAXException(tr("Parse error: invalid document structure for GPX document."));
-            data = currentData;
+            Extensions metaExt = (Extensions) data.attr.get(GpxData.META_EXTENSIONS);
+            if (metaExt != null && "true".equals(metaExt.get("from-server"))) {
+                data.fromServer = true;
+            }
+            gpxData = data;
         }
 
@@ -418,6 +434,5 @@
         try {
             SAXParserFactory factory = SAXParserFactory.newInstance();
-            // support files with invalid xml namespace declarations (see #7247)
-            factory.setNamespaceAware(false);
+            factory.setNamespaceAware(true);
             factory.newSAXParser().parse(inputSource, parser);
             return true;
@@ -425,5 +440,5 @@
             if (tryToFinish) {
                 parser.tryToFinish();
-                if (parser.currentData.isEmpty())
+                if (parser.data.isEmpty())
                     throw e;
                 return false;
@@ -435,3 +450,7 @@
         }
     }
+
+    public GpxData getGpxData() {
+        return gpxData;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/io/GpxWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 5679)
@@ -52,6 +52,7 @@
         out.println("<?xml version='1.0' encoding='UTF-8'?>");
         out.println("<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
+                (data.fromServer ? String.format("    xmlns:josm=\"%s\"\n", GpxData.JOSM_EXTENSIONS_NAMESPACE_URI) : "") +
                 "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" +
-        "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">");
+                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">");
         indent = "  ";
         writeMetaData();
@@ -99,7 +100,7 @@
             simpleTag("name", (String) attr.get(GpxData.META_AUTHOR_NAME));
             // write the email address
-            if(attr.containsKey(GpxData.META_AUTHOR_EMAIL)) {
+            if (attr.containsKey(GpxData.META_AUTHOR_EMAIL)) {
                 String[] tmp = ((String)attr.get(GpxData.META_AUTHOR_EMAIL)).split("@");
-                if(tmp.length == 2) {
+                if (tmp.length == 2) {
                     inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+"\"");
                 }
@@ -111,11 +112,11 @@
 
         // write the copyright details
-        if(attr.containsKey(GpxData.META_COPYRIGHT_LICENSE)
+        if (attr.containsKey(GpxData.META_COPYRIGHT_LICENSE)
                 || attr.containsKey(GpxData.META_COPYRIGHT_YEAR)) {
             openAtt("copyright", "author=\""+ attr.get(GpxData.META_COPYRIGHT_AUTHOR) +"\"");
-            if(attr.containsKey(GpxData.META_COPYRIGHT_YEAR)) {
+            if (attr.containsKey(GpxData.META_COPYRIGHT_YEAR)) {
                 simpleTag("year", (String) attr.get(GpxData.META_COPYRIGHT_YEAR));
             }
-            if(attr.containsKey(GpxData.META_COPYRIGHT_LICENSE)) {
+            if (attr.containsKey(GpxData.META_COPYRIGHT_LICENSE)) {
                 simpleTag("license", encode((String) attr.get(GpxData.META_COPYRIGHT_LICENSE)));
             }
@@ -124,5 +125,5 @@
 
         // write links
-        if(attr.containsKey(GpxData.META_LINKS)) {
+        if (attr.containsKey(GpxData.META_LINKS)) {
             for (GpxLink link : (Collection<GpxLink>) attr.get(GpxData.META_LINKS)) {
                 gpxLink(link);
@@ -136,9 +137,14 @@
 
         Bounds bounds = data.recalculateBounds();
-        if(bounds != null)
-        {
+        if (bounds != null) {
             String b = "minlat=\"" + bounds.getMin().lat() + "\" minlon=\"" + bounds.getMin().lon() +
             "\" maxlat=\"" + bounds.getMax().lat() + "\" maxlon=\"" + bounds.getMax().lon() + "\"" ;
             inline("bounds", b);
+        }
+
+        if (data.fromServer) {
+            openln("extensions");
+            simpleTag("josm:from-server", "true");
+            closeln("extensions");
         }
 
Index: /trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java	(revision 5678)
+++ /trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java	(revision 5679)
@@ -167,5 +167,5 @@
                 GpxReader reader = new GpxReader(in);
                 gpxParsedProperly = reader.parse(false);
-                GpxData result = reader.data;
+                GpxData result = reader.getGpxData();
                 result.fromServer = true;
                 return result;
