gt: 		xr.doImport(new InputSource(is), handler);
context: /*
   *    Debrief - the Open Source Maritime Analysis Application
   *    http://debrief.info
   *
   *    (C) 2000-2014, PlanetMayo Ltd
   *
   *    This library is free software; you can redistribute it and/or
   *    modify it under the terms of the Eclipse Public License v1.0
   *    (http://www.eclipse.org/legal/epl-v10.html)
   *
   *    This library 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. 
   */
  
  package ASSET.Util.XML;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.Vector;
  
  import javax.xml.parsers.ParserConfigurationException;
  
  import org.w3c.dom.DOMImplementation;
  import org.w3c.dom.Document;
  import org.xml.sax.InputSource;
  
  import com.sun.org.apache.xml.internal.serialize.OutputFormat;
  import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
  
  import ASSET.NetworkParticipant;
  import ASSET.ScenarioType;
  import ASSET.Models.SensorType;
  import ASSET.Models.Sensor.SensorList;
  import ASSET.Scenario.Observers.ScenarioObserver;
  import ASSET.Util.XML.Control.StandaloneObserverListHandler;
  import ASSET.Util.XML.Control.Observers.ScenarioControllerHandler;
  import ASSET.Util.XML.Decisions.WaterfallHandler;
  import MWC.GUI.BaseLayer;
  import MWC.GUI.Layer;
  import MWC.GUI.Layers;
  import MWC.Utilities.ReaderWriter.XML.LayersHandler;
  import MWC.Utilities.ReaderWriter.XML.MWCXMLReader;
  
  /**
   * @author IAN MAYO
   */
  public class ASSETReaderWriter extends MWC.Utilities.ReaderWriter.XML.MWCXMLReaderWriter
  {
  
  	ScenarioHandler _theScenarioHandler;
  
  	/**
  	 * Creates new XMLReaderWriter
  	 */
  	public ASSETReaderWriter()
  	{
  	}
  
  	static public NetworkParticipant readThis(final java.io.File file)
  	{
  		NetworkParticipant res = null;
  		try
  		{
  			final java.io.FileInputStream str = new java.io.FileInputStream(file);
  
  			res = importParticipant("Scrap", str);
  		}
  		catch (java.io.IOException e)
  		{
  			e.printStackTrace();
  		}
  
  		return res;
  	}
  
  	// ///////////////////////////////////////////////////////////////////
  	//
  	// ////////////////////////////////////////////////////////////////////
  
  	/**
  	 * handle the import of XML data into an existing session
  	 */
  	@Override
  	public void importThis(String fName, final java.io.InputStream is, final MWC.GUI.Layers theData)
  	{
  		final MWCXMLReader handler = new LayersHandler(theData);
  
  		// import the datafile into this set of layers
  		doImport(new InputSource(is), handler);
  
  		//
  		theData.fireModified(null);
  	}
  
  	/**
  	 * handle the import of XML data, creating a new session for it
  	 */
  	static public void importThis(final ASSET.Scenario.CoreScenario theScenario, final String fName, final java.io.InputStream is)
  	{
  		// create the new handler
  		final ASSETReaderWriter xr = new ASSETReaderWriter();
  
  		final Layers backdropHolder = new Layers();
  
  		final MWCXMLReader handler = new ScenarioHandler(theScenario, backdropHolder);
  
  		// import the datafile into this set of layers
  		xr.doImport(new InputSource(is), handler);
  
  		if (backdropHolder.size() > 0)
  		{
  			Layer firstLayer = backdropHolder.elementAt(0);
  			if (firstLayer instanceof BaseLayer)
  			{
  				theScenario.setBackdrop((BaseLayer) firstLayer);
  			}
  		}
  
  	}
  
  	/**
  	 * handle the import of XML data, creating a new session for it
  	 */
  	static public void importThis(final ASSET.Scenario.CoreScenario theScenario, final Layers theLayers, final String fName,
  			final java.io.InputStream is)
  	{
  		// create the new handler
  		final ASSETReaderWriter xr = new ASSETReaderWriter();
  
  		final MWCXMLReader handler = new ScenarioHandler(theScenario, theLayers);
  
  		// import the datafile into this set of layers
  		xr.doImport(new InputSource(is), handler);
  	}
  
  	/**
  	 * handle the import of XML data, creating a new session for it
  	 * 
  	 * @param fName
  	 *          the filename to read from (largely ignored)
  	 * @param is
  	 *          an input stream to read from
  	 * @return the output directory to write, if applicable
  	 */
  	static public ResultsContainer importThisControlFile(final String fName, final java.io.InputStream is)
  	{
  		// create the new handler
  		final ASSETReaderWriter xr = new ASSETReaderWriter();
  
  		final Vector<ResultsContainer> resultsHolder = new Vector<ResultsContainer>(0, 1);
  
  		final MWCXMLReader handler = new ScenarioControllerHandler()
  		{
  			@Override
  			public void setResults(ResultsContainer results)
  			{
  				resultsHolder.add(results);
  			}
  		};
  
  		// import the datafile into this set of layers
  		InputSource inputStream = new InputSource(is);
  
  		xr.doImport(inputStream, handler);
  
  		ResultsContainer results = null;
  
  		// did we get an output holder?
  		// File outputDirectory = null;
  		if (resultsHolder.size() > 0)
  		{
  			results = resultsHolder.firstElement();
  		}
  
  		return results;
  
  	}
  
  	/**
  	 * handle the import of XML data, creating a new session for it
  	 */
  	static public Vector<ScenarioObserver> importThisObserverList(final String fName, final java.io.InputStream is)
  	{
  		// create the new handler
  		final ASSETReaderWriter xr = new ASSETReaderWriter();
  
  		final Vector<ScenarioObserver> res = new Vector<ScenarioObserver>(0, 1);
  
  		final MWCXMLReader handler = new StandaloneObserverListHandler()
  		{
  			@Override
  			public void setObserverList(Vector<ScenarioObserver> list)
  			{
  				res.addAll(list);
  			}
  		};
  
  		// import the datafile into this set of layers
  		xr.doImport(new InputSource(is), handler);
  
  		return res;
  	}
  
  	/**
  	 * handle the import of XML data, creating a new session for it
  	 */
  	static public void importThis(final MWC.GUI.Layers layers, final java.io.InputStream is)
  	{
  		// create the new handler
  		final ASSETReaderWriter xr = new ASSETReaderWriter();
  
  		final MWCXMLReader handler = new MWC.Utilities.ReaderWriter.XML.LayersHandler(layers);
  
  		// import the datafile into this set of layers
  