Changeset 206 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder


Ignore:
Timestamp:
02/03/2020 04:01:55 PM (6 years ago)
Author:
jdalbey
Message:

Modify prettyprint code to prepend xml header lines AFTER the pretty printing to fix #239. Removes incident_script.dtd from trunk as it isn't needed for xml save anymore.

Location:
trunk/src/scriptbuilder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/application.properties

    r201 r206  
    1 #Wed, 29 Jan 2020 05:08:10 -0800 
     1#Mon, 03 Feb 2020 16:55:57 -0800 
    22 
    3 Application.revision=198 
     3Application.revision=205 
    44 
    5 Application.buildnumber=54 
     5Application.buildnumber=55 
    66 
    77Incidents.directory=Incidents 
  • trunk/src/scriptbuilder/structures/SimulationScript.java

    r203 r206  
    353353             
    354354        } 
    355          
    356          
    357     } 
     355    } 
     356 
    358357    @Override 
    359358    public String toXML() 
    360359    { 
    361360        ArrayList<TimeSlice> slices = arrangeAllSlices(); 
    362         String output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 
    363         output += XMLBuilder.externalDTD(); 
     361        String output = ""; 
    364362        output += XMLBuilder.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\""); 
    365363 
  • trunk/src/scriptbuilder/structures/XMLBuilder.java

    r205 r206  
    8484 
    8585    /** 
    86      * Generates the link to external DTD for XML script files. 
    87      * 
    88      * @return 
     86     * @return the xml string with the link to external DTD for XML script files. 
    8987     */ 
    9088    public static String externalDTD() 
    9189    { 
    92         String output = ""; 
    93         output += "<!DOCTYPE TMC_SCRIPT SYSTEM \"incident_script.dtd\">\n"; 
    94         return output; 
     90        return "<!DOCTYPE TMC_SCRIPT SYSTEM \"incident_script.dtd\">\n"; 
    9591    } 
    96      
     92    /** 
     93     * @return The xml string that starts the document. 
     94     */ 
     95    public static String xmlHeader() 
     96    { 
     97        return "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 
     98    } 
    9799    /** 
    98100     * Prettyprint an XML string. 
     
    111113            e.printStackTrace(); 
    112114        } 
     115        // Prepend the header and externalDTD lines.  (This must be done after 
     116        // prettyprinting, which tries to read the externalDTD if the link is present.) 
     117        // Fixes #239. 
     118        formattedXML = xmlHeader() + externalDTD() + formattedXML; 
    113119        return formattedXML; 
    114120    } 
Note: See TracChangeset for help on using the changeset viewer.