support GPX 1.1 too
authorRichard Fairhurst <richard@systemed.net>
Sun, 5 Dec 2010 16:44:58 +0000 (16:44 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sun, 5 Dec 2010 16:44:58 +0000 (16:44 +0000)
net/systemeD/halcyon/connection/Trace.as
net/systemeD/potlatch2/utils/GpxImporter.as
net/systemeD/potlatch2/utils/TrackLoader.as

index 8d222a7..4662bf4 100644 (file)
@@ -99,8 +99,12 @@ package net.systemeD.halcyon.connection {
         }
 
         private function process():void {
         }
 
         private function process():void {
-            default xml namespace = new Namespace("http://www.topografix.com/GPX/1/0");
             var file:XML = new XML(_traceData);
             var file:XML = new XML(_traceData);
+                       for each (var ns:Namespace in file.namespaceDeclarations()) {
+                               if (ns.uri.match(/^http:\/\/www\.topografix\.com\/GPX\/1\/[01]$/)) {
+                                       default xml namespace = ns;
+                               }
+                       }
 
             for each (var trkseg:XML in file..trkseg) {
                 var way:Way;
 
             for each (var trkseg:XML in file..trkseg) {
                 var way:Way;
@@ -117,7 +121,7 @@ package net.systemeD.halcyon.connection {
             for each (var wpt:XML in file.wpt) {
                 var tags:Object = {};
                 for each (var tag:XML in wpt.children()) {
             for each (var wpt:XML in file.wpt) {
                 var tags:Object = {};
                 for each (var tag:XML in wpt.children()) {
-                    tags[tag.name()]=tag.toString();
+                    tags[tag.name().localName]=tag.toString();
                 }
                 var node:Node = layer.createNode(tags, wpt.@lat, wpt.@lon);
                                layer.registerPOI(node);
                 }
                 var node:Node = layer.createNode(tags, wpt.@lat, wpt.@lon);
                                layer.registerPOI(node);
index 2092e24..40f41df 100644 (file)
@@ -17,8 +17,12 @@ package net.systemeD.potlatch2.utils {
                }
 
                override protected function doImport(): void {
                }
 
                override protected function doImport(): void {
-            default xml namespace = new Namespace("http://www.topografix.com/GPX/1/0");
                        var file:XML = new XML(files[0]);
                        var file:XML = new XML(files[0]);
+                       for each (var ns:Namespace in file.namespaceDeclarations()) {
+                               if (ns.uri.match(/^http:\/\/www\.topografix\.com\/GPX\/1\/[01]$/)) {
+                                       default xml namespace = ns;
+                               }
+                       }
 
                        for each (var trkseg:XML in file..trkseg) {
                                var way:Way;
 
                        for each (var trkseg:XML in file..trkseg) {
                                var way:Way;
@@ -35,7 +39,7 @@ package net.systemeD.potlatch2.utils {
             for each (var wpt:XML in file.wpt) {
                                var tags:Object = {};
                                for each (var tag:XML in wpt.children()) {
             for each (var wpt:XML in file.wpt) {
                                var tags:Object = {};
                                for each (var tag:XML in wpt.children()) {
-                                       tags[tag.name()]=tag.toString();
+                                       tags[tag.name().localName]=tag.toString();
                                }
                                var node:Node = container.createNode(tags, wpt.@lat, wpt.@lon);
                                container.registerPOI(node);
                                }
                                var node:Node = container.createNode(tags, wpt.@lat, wpt.@lon);
                                container.registerPOI(node);
index 03cb67d..4a0e170 100644 (file)
@@ -47,8 +47,12 @@ package net.systemeD.potlatch2.utils {
                }
 
                public function parseGPX(event:Event):void {
                }
 
                public function parseGPX(event:Event):void {
-            default xml namespace = new Namespace("http://www.topografix.com/GPX/1/0");
                        var file:XML = new XML(event.target.data);
                        var file:XML = new XML(event.target.data);
+                       for each (var ns:Namespace in file.namespaceDeclarations()) {
+                               if (ns.uri.match(/^http:\/\/www\.topografix\.com\/GPX\/1\/[01]$/)) {
+                                       default xml namespace = ns;
+                               }
+                       }
 
                        for each (var trkseg:XML in file..trkseg) {
                                var nodestring:Array = [];
 
                        for each (var trkseg:XML in file..trkseg) {
                                var nodestring:Array = [];