Changeset 46 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/structures/SimulationScript.java


Ignore:
Timestamp:
08/07/2017 04:20:08 PM (9 years ago)
Author:
bmcguffin
Message:

Added file: XMLWriter, in package Scriptbuilder.structures. It holds static methods which ither classes that implement I_XML_Writable may find useful. Also restructured the toXML method of many classes to utilize this new class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/structures/SimulationScript.java

    r38 r46  
    186186        String output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 
    187187        output += "<!DOCTYPE TMC_SCRIPT SYSTEM \"script.dtd\">\n"; 
    188         output += openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\""); 
     188        output += XMLWriter.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\""); 
    189189 
    190190        if (units.size() > 0) 
    191191        { 
    192             output += openTag(ELEMENT.SCRIPT_DATA.tag); 
     192            output += XMLWriter.openTag(ELEMENT.SCRIPT_DATA.tag); 
    193193            for (Unit unit : units) 
    194194            { 
    195195                output += unit.toXML(); 
    196196            } 
    197             output += closeTag(ELEMENT.SCRIPT_DATA.tag); 
     197            output += XMLWriter.closeTag(ELEMENT.SCRIPT_DATA.tag); 
    198198        } 
    199199        for (TimeSlice slice : slices) 
     
    201201            output += slice.toXML(); 
    202202        } 
    203         output += closeTag(ELEMENT.TMC_SCRIPT.tag); 
     203        output += XMLWriter.closeTag(ELEMENT.TMC_SCRIPT.tag); 
    204204        return output; 
    205205    } 
    206  
    207     @Override 
    208     public String openTag(String s) 
    209     { 
    210         return "<" + s + ">"; 
    211     } 
    212  
    213     @Override 
    214     public String closeTag(String s) 
    215     { 
    216         return "</" + s + ">\n"; 
    217     } 
    218  
    219     @Override 
    220     public String emptyTag(String s) 
    221     { 
    222         return "<" + s + "/>\n"; 
    223     } 
    224  
    225206    /** 
    226207     * Arranges all timeslices in this script in chronological order, then by 
Note: See TracChangeset for help on using the changeset viewer.