Index: /applications/editors/josm/plugins/opendata/.classpath
===================================================================
--- /applications/editors/josm/plugins/opendata/.classpath	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/.classpath	(revision 28031)
@@ -12,4 +12,5 @@
 	<classpathentry kind="src" path="modules/fr.sncf/src"/>
 	<classpathentry kind="src" path="modules/fr.toulouse/src"/>
+	<classpathentry kind="src" path="modules/fr.toulouse/resources"/>
 	<classpathentry kind="src" path="util"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Index: /applications/editors/josm/plugins/opendata/modules/00_module_dir_template/build.xml
===================================================================
--- /applications/editors/josm/plugins/opendata/modules/00_module_dir_template/build.xml	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/modules/00_module_dir_template/build.xml	(revision 28031)
@@ -74,9 +74,9 @@
     **********************************************************
     -->
-	<target name="copy-resources" if="resources.exist">
+    <target name="copy-resources" if="resources.exist">
         <copy todir="${module.build.dir}">
             <fileset dir="resources" />
         </copy>
-	</target>
+    </target>
     <!--
     **********************************************************
Index: /applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java
===================================================================
--- /applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java	(revision 28031)
@@ -21,10 +21,14 @@
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.plugins.opendata.core.io.NeptuneReader;
 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler;
 
 public class ReseauTisseoHandler extends ToulouseDataSetHandler {
 
+	private static final URL neptuneSchemaUrl = ReseauTisseoHandler.class.getResource(TOULOUSE_NEPTUNE_XSD);
+	
 	public ReseauTisseoHandler() {
 		super(14022, "network=fr_tisseo");
+		NeptuneReader.registerSchema(neptuneSchemaUrl);
 	}
 
@@ -39,13 +43,5 @@
 	@Override
 	public boolean acceptsFile(File file) {
-		return acceptsFilename(file.getName()) && (file.getName().toLowerCase().endsWith(ZIP_EXT) || acceptsXmlNeptuneFile(file));
-	}
-
-	/* (non-Javadoc)
-	 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchDataSetHandler#getNeptuneSchema()
-	 */
-	@Override
-	protected URL getNeptuneSchema() {
-		return ReseauTisseoHandler.class.getResource(TOULOUSE_NEPTUNE_XSD);
+		return acceptsFilename(file.getName()) && (file.getName().toLowerCase().endsWith(ZIP_EXT) || NeptuneReader.acceptsXmlNeptuneFile(file, neptuneSchemaUrl));
 	}
 
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java	(revision 28031)
@@ -45,4 +45,6 @@
 	private static OdPlugin instance;
 	
+	public final XmlImporter xmlImporter;
+	
 	public OdPlugin(PluginInformation info) { // NO_UCD
 		super(info);
@@ -57,5 +59,5 @@
 				new KmlKmzImporter(), new ShpImporter(), new MifTabImporter(), // Geographic file formats
 				new ZipImporter(), // Archive containing any of the others
-				new XmlImporter() // Generic importer for XML files (currently used for Neptune files)
+				xmlImporter = new XmlImporter() // Generic importer for XML files (currently used for Neptune files)
 		})) {
 			ExtensionFileFilter.importers.add(0, importer);
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/au/AustralianConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/au/AustralianConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/au/AustralianConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.au;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface AustralianConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String AUSTRALIAN_PORTAL = "http://data.gov.au/dataset/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_AU_24 = "au24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/ca/CanadianConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/ca/CanadianConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/ca/CanadianConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.ca;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface CanadianConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String CANADIAN_PORTAL = "http://www.data.gc.ca/geo/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_CA_24 = "ca24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/cl/ChileanConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/cl/ChileanConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/cl/ChileanConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.cl;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface ChileanConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String CHILEAN_PORTAL = "http://datos.gob.cl/datasets/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_CL_24 = "cl24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/es/SpanishConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/es/SpanishConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/es/SpanishConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.es;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface SpanishConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String SPANISH_PORTAL = "http://datos.gob.es/datos/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_ES_24 = "es24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchDataSetHandler.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchDataSetHandler.java	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchDataSetHandler.java	(revision 28031)
@@ -18,6 +18,4 @@
 import static org.openstreetmap.josm.plugins.opendata.core.io.LambertCC9ZonesProjectionPatterns.lambertCC9Zones;
 
-import java.io.File;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -26,11 +24,4 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
 
 import org.geotools.referencing.CRS;
@@ -47,5 +38,4 @@
 import org.openstreetmap.josm.data.projection.UTM.Hemisphere;
 import org.openstreetmap.josm.plugins.opendata.core.datasets.SimpleDataSetHandler;
-import org.xml.sax.SAXException;
 
 public abstract class FrenchDataSetHandler extends SimpleDataSetHandler implements FrenchConstants {
@@ -283,29 +273,3 @@
 		}
 	}
-	
-	protected URL getNeptuneSchema() {
-		return FrenchDataSetHandler.class.getResource(NEPTUNE_XSD);
-	}
-
-	public final boolean acceptsXmlNeptuneFile(File file) {
-		
-		Source xmlFile = new StreamSource(file);
-		
-		try {
-			SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-			Schema schema = schemaFactory.newSchema(getNeptuneSchema());
-			Validator validator = schema.newValidator();
-			validator.validate(xmlFile);
-			System.out.println(xmlFile.getSystemId() + " is valid");
-			return true;
-		} catch (SAXException e) {
-			System.out.println(xmlFile.getSystemId() + " is NOT valid");
-			System.out.println("Reason: " + e.getLocalizedMessage());
-		} catch (IOException e) {
-			System.out.println(xmlFile.getSystemId() + " is NOT valid");
-			System.out.println("Reason: " + e.getLocalizedMessage());
-		}
-		
-		return false;
-	}
 }
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/it/ItalianConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/it/ItalianConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/it/ItalianConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.it;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface ItalianConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String ITALIAN_PORTAL = "http://www.dati.gov.it/content/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_IT_24 = "it24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/ke/KenyanConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/ke/KenyanConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/ke/KenyanConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.ke;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface KenyanConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String KENYAN_PORTAL = "https://opendata.go.ke/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_KE_24 = "ke24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/nl/DutchConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/nl/DutchConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/nl/DutchConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.nl;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface DutchConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String NORWEGIAN_PORTAL = "http://data.overheid.nl/package/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_NL_24 = "nl24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/no/NorwegianConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/no/NorwegianConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/no/NorwegianConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.no;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface NorwegianConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String NORWEGIAN_PORTAL = "http://data.norge.no/data/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_NO_24 = "no24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/nz/NewZealanderConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/nz/NewZealanderConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/nz/NewZealanderConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.nz;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface NewZealanderConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String NEW_ZEALANDER_PORTAL = "http://data.govt.nz/dataset/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_NZ_24 = "nz24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/pt/PortugueseConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/pt/PortugueseConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/pt/PortugueseConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.pt;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface PortugueseConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String PORTUGUESE_PORTAL = "http://www.dados.gov.pt/PT/CatalogoDados/Dados.aspx?name=";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_PT_24 = "pt24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/uk/BritishConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/uk/BritishConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/uk/BritishConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.uk;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface BritishConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String BRITISH_PORTAL = "http://data.gov.uk/dataset/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_UK_24 = "uk24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/us/AmericanConstants.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/us/AmericanConstants.java	(revision 28031)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/us/AmericanConstants.java	(revision 28031)
@@ -0,0 +1,31 @@
+//    JOSM opendata plugin.
+//    Copyright (C) 2011-2012 Don-vip
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 3 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+package org.openstreetmap.josm.plugins.opendata.core.datasets.us;
+
+import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+
+public interface AmericanConstants extends OdConstants {
+
+	/**
+	 * Portal
+	 */
+	public static final String AMERICAN_PORTAL = "http://explore.data.gov/";
+	
+	/**
+	 * Icon
+	 */
+	public static final String ICON_US_24 = "us24.png";
+}
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NeptuneReader.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NeptuneReader.java	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NeptuneReader.java	(revision 28031)
@@ -16,13 +16,23 @@
 package org.openstreetmap.josm.plugins.opendata.core.io;
 
+import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
 
 import neptune.ChouetteAreaType;
@@ -50,4 +60,6 @@
 import org.openstreetmap.josm.io.AbstractReader;
 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler;
+import org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchConstants;
+import org.xml.sax.SAXException;
 
 /**
@@ -55,5 +67,5 @@
  * See http://www.chouette.mobi/IMG/pdf/NF__F_-Neptune-maj.pdf 
  */
-public class NeptuneReader extends AbstractReader {
+public class NeptuneReader extends AbstractReader implements FrenchConstants {
 
 	public static final String OSM_PUBLIC_TRANSPORT = "public_transport";
@@ -76,7 +88,42 @@
 	public static final String OSM_FERRY = "ferry";
 
+	private static final List<URL> schemas = new ArrayList<URL>();
+	static {
+		schemas.add(NeptuneReader.class.getResource(NEPTUNE_XSD));
+	}
+	
 	private ChouettePTNetworkType root;
 	
 	private final Map<String, OsmPrimitive> tridentObjects = new HashMap<String, OsmPrimitive>();
+	
+	public static final boolean acceptsXmlNeptuneFile(File file) {
+		return acceptsXmlNeptuneFile(file, null);
+	}
+
+	public static final boolean acceptsXmlNeptuneFile(File file, URL schemaURL) {
+		
+		if (schemaURL == null) {
+			schemaURL = schemas.get(0);
+		}
+		
+		Source xmlFile = new StreamSource(file);
+		
+		try {
+			SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+			Schema schema = schemaFactory.newSchema(schemaURL);
+			Validator validator = schema.newValidator();
+			validator.validate(xmlFile);
+			System.out.println(xmlFile.getSystemId() + " is valid");
+			return true;
+		} catch (SAXException e) {
+			System.out.println(xmlFile.getSystemId() + " is NOT valid");
+			System.out.println("Reason: " + e.getLocalizedMessage());
+		} catch (IOException e) {
+			System.out.println(xmlFile.getSystemId() + " is NOT valid");
+			System.out.println("Reason: " + e.getLocalizedMessage());
+		}
+		
+		return false;
+	}
 	
 	public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws JAXBException {
@@ -102,4 +149,12 @@
 		Node n = new Node(latlon);
 		ds.addPrimitive(n);
+		return n;
+	}
+	
+	private Node createPlatform(StopPointType stop) {
+		Node n = createNode(createLatLon(stop));
+		n.put(OSM_PUBLIC_TRANSPORT, OSM_PLATFORM);
+		linkTridentObjectToOsmPrimitive(stop, n);
+		n.put("name", stop.getName());
 		return n;
 	}
@@ -223,5 +278,4 @@
 								for (String grandchildId : child.getContains()) {
 									if (grandchildId.contains("StopPoint")) {
-										// TODO
 										StopPoint grandchild = findStopPoint(grandchildId);
 										if (grandchild == null) {
@@ -229,6 +283,6 @@
 										} else {
 											if (grandchild.getLongLatType().equals(LongLatTypeType.WGS_84)) {
-												Node stop = createStopPosition(grandchild);
-												stopArea.addMember(new RelationMember(OSM_STOP, stop));
+												Node platform = createPlatform(grandchild);
+												stopArea.addMember(new RelationMember(OSM_PLATFORM, platform));
 											} else {
 												System.err.println("Unsupported long/lat type: "+grandchild.getLongLatType());
@@ -248,5 +302,5 @@
 									for (RelationMember member : stopArea.getMembers()) {
 										// Fix stop coordinates if needed
-										if (member.getRole().equals(OSM_STOP) && isNullLatLon(member.getNode().getCoor())) {
+										if (member.getRole().equals(OSM_PLATFORM) && isNullLatLon(member.getNode().getCoor())) {
 											member.getNode().setCoor(createLatLon(areaCentroid));
 										}
@@ -295,5 +349,5 @@
 					if (start == null) {
 						System.err.println("Cannot find start StopPoint: "+ptlink.getStartOfLink());
-					} else {
+					} else if (start.get(OSM_PUBLIC_TRANSPORT).equals(OSM_STOP) || start.get(OSM_PUBLIC_TRANSPORT).equals(OSM_PLATFORM)) {
 						addStopToRoute(route, start);
 					}
@@ -301,5 +355,5 @@
 					if (end == null) {
 						System.err.println("Cannot find end StopPoint: "+ptlink.getEndOfLink());
-					} else {
+					} else if (end.get(OSM_PUBLIC_TRANSPORT).equals(OSM_STOP) || end.get(OSM_PUBLIC_TRANSPORT).equals(OSM_PLATFORM)) {
 						addStopToRoute(route, end);
 					}
@@ -310,8 +364,8 @@
 		return ds;
 	}
-	
+		
 	private static final boolean addStopToRoute(Relation route, OsmPrimitive stop) {
 		if (route.getMembersCount() == 0 || !route.getMember(route.getMembersCount()-1).getMember().equals(stop) ) {
-			route.addMember(new RelationMember(OSM_STOP, stop));
+			route.addMember(new RelationMember(stop.get(OSM_PUBLIC_TRANSPORT), stop));
 			return true;
 		} else {
@@ -319,3 +373,13 @@
 		}
 	}
+
+	public static List<URL> getSchemas() {
+		return schemas;
+	}
+
+	public static void registerSchema(URL resource) {
+		if (resource != null && !schemas.contains(resource)) {
+			schemas.add(resource);
+		}
+	}
 }
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/XmlImporter.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/XmlImporter.java	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/XmlImporter.java	(revision 28031)
@@ -16,5 +16,7 @@
 package org.openstreetmap.josm.plugins.opendata.core.io;
 
+import java.io.File;
 import java.io.InputStream;
+import java.net.URL;
 
 import javax.xml.bind.JAXBException;
@@ -30,9 +32,23 @@
 	}
 	
+	/* (non-Javadoc)
+	 * @see org.openstreetmap.josm.io.FileImporter#acceptFile(java.io.File)
+	 */
+	@Override
+	public boolean acceptFile(File pathname) {
+		if (super.acceptFile(pathname)) {
+			for (URL schemaURL : NeptuneReader.getSchemas()) {
+				if (NeptuneReader.acceptsXmlNeptuneFile(pathname, schemaURL)) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
 	@Override
 	protected DataSet parseDataSet(InputStream in, ProgressMonitor instance)
 			throws IllegalDataException {
 		try {
-			// TODO: check it is a neptune file
 			return NeptuneReader.parseDataSet(in, handler, instance);
 		} catch (JAXBException e) {
Index: /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java
===================================================================
--- /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java	(revision 28030)
+++ /applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java	(revision 28031)
@@ -33,7 +33,7 @@
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.AbstractReader;
+import org.openstreetmap.josm.plugins.opendata.OdPlugin;
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler;
-import org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchDataSetHandler;
 import org.openstreetmap.josm.plugins.opendata.core.io.NeptuneReader;
 import org.openstreetmap.josm.plugins.opendata.core.io.geographic.KmlReader;
@@ -146,5 +146,5 @@
 					from = TabReader.parseDataSet(in, file, handler, instance);
 				} else if (file.getName().toLowerCase().endsWith(XML_EXT)) {
-					if (handler instanceof FrenchDataSetHandler && ((FrenchDataSetHandler)handler).acceptsXmlNeptuneFile(file)) {
+					if (OdPlugin.getInstance().xmlImporter.acceptFile(file)) {
 						from = NeptuneReader.parseDataSet(in, handler, instance);
 					} else {
