if (entity instanceof Mech) { if ( ((Mech)entity).isAutoEject() ) { output.write( "\" autoeject=\"true" ); } else { output.write ("\" autoeject=\"false" ); } }
    public static void saveTo( String filePath, String fileName, Vector list )        throws IOException {        /*        ** The EXE can't seem to handle UTF-8 files.  Possible build problem.        ** TODO: restore UTF-8 once root cause solved.        **        // Open up the file.  Produce UTF-8 output.        Writer output = new BufferedWriter( new OutputStreamWriter            ( new FileOutputStream(new File(filePath, fileName)), "UTF-8" )            );        // Output the doctype and header stuff.        output.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );        */        // Open up the file.        Writer output = new BufferedWriter( new OutputStreamWriter            ( new FileOutputStream(new File(filePath, fileName)) )            );        // Output the doctype and header stuff.        output.write( "<?xml version=\"1.0\"?>" );        output.write( Settings.NL );        output.write( Settings.NL );        output.write( "<unit>" );        output.write( Settings.NL );        output.write( Settings.NL );        // Walk through the list of entities.        Enumeration items = list.elements();        while ( items.hasMoreElements() ) {            final Entity entity = (Entity) items.nextElement();            // Start writing this entity to the file.            output.write( "   <entity chassis=\"" );            output.write( entity.getChassis() );            output.write( "\" model=\"" );            output.write( entity.getModel() );            output.write( "\" type=\"" );            output.write( entity.getMovementTypeAsString() );            output.write( "\">" );            output.write( Settings.NL );            // Add the crew this entity.            final Pilot crew = entity.getCrew();            output.write( "      <pilot name=\"" );            output.write( crew.getName() );            output.write( "\" gunnery=\"" );            output.write( String.valueOf(crew.getGunnery()) );            output.write( "\" piloting=\"" );            output.write( String.valueOf(crew.getPiloting()) );            if ( crew.isDead() || crew.getHits() > 5 ) {                output.write( "\" hits=\"Dead" );            }            else if ( crew.getHits() > 0 ) {                output.write( "\" hits=\"" );                output.write( String.valueOf(crew.getHits()) );            }            if ( crew.countAdvantages() > 0 ) {                output.write( "\" advantages=\"" );                output.write( String.valueOf(crew.getAdvantageList("::")) );            }            output.write( "\"/>" );            output.write( Settings.NL );            // Add the locations of this entity (if any are needed).            String loc = getLocString( entity );            if ( null != loc ) {                output.write( loc );            }            // Finish writing this entity to the file.            output.write( "   </entity>" );            output.write( Settings.NL );            output.write( Settings.NL );        } // Handle the next entity        // Finish writing.        output.write( "</unit>" );        output.write( Settings.NL );        output.flush();        output.close();    }