diff --git a/src/com/urizev/gpx/GPXParser.java b/src/com/urizev/gpx/GPXParser.java index 6d2ba70..7ce6290 100644 --- a/src/com/urizev/gpx/GPXParser.java +++ b/src/com/urizev/gpx/GPXParser.java @@ -514,16 +514,11 @@ private Route parseRoute(Node node) throws Exception { } } else if (GPXConstants.EXTENSIONS_NODE.equals(currentNode .getNodeName())) { - Iterator it = this.extensionParsers - .iterator(); - while (it.hasNext()) { - while (it.hasNext()) { - IExtensionParser parser = it.next(); - Object data = parser - .parseRouteExtension(currentNode); - rte.addExtensionData(parser.getId(), data); - } - } + for ( IExtensionParser extensionParser : extensionParsers ) + { + Object data = extensionParser.parseRouteExtension( currentNode ); + if (data != null) rte.addExtensionData( extensionParser.getId( ), data ); + } } } } @@ -568,15 +563,10 @@ private Track parseTrack(Node node) throws Exception { trk.addTrackSegment(segment); } else if (GPXConstants.EXTENSIONS_NODE.equals(currentNode .getNodeName())) { - Iterator it = this.extensionParsers - .iterator(); - while (it.hasNext()) { - while (it.hasNext()) { - IExtensionParser parser = it.next(); - Object data = parser - .parseTrackExtension(currentNode); - trk.addExtensionData(parser.getId(), data); - } + for ( IExtensionParser extensionParser : extensionParsers ) + { + Object data = extensionParser.parseTrackExtension( currentNode ); + if (data != null) trk.addExtensionData( extensionParser.getId( ), data ); } } }