Location: Metabolic Component Library @ 702b54b45018 / CellML-source / CellMLTools / src / tools / CellMLWriter.java

Author:
Randall Britten <r.britten@auckland.ac.nz>
Date:
2013-04-17 15:30:14+12:00
Desc:
To "clone" an imported component, the top level import element needs to be duplicated, not just the component reference within an existing import. The rationale is that all connections within a top-level import are kept intact, as dictated by the encapsulation in the imported model.
Permanent Source URI:
https://staging.physiomeproject.org/w/matthiaskoenig/MetabolicComponentLibrary/rawfile/702b54b45018b04ef1bc074677379dc20d983234/CellML-source/CellMLTools/src/tools/CellMLWriter.java

package tools;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import cellml_api.Model;

public class CellMLWriter {
  public static void writeToFile(Model model, String outputFileName ){
    try{
      PrintWriter writer = new PrintWriter(new FileWriter(outputFileName));
      writer.println(model.getSerialisedText());
      writer.close();
    }
    catch(IOException e)
    {
      e.printStackTrace();
    }
  }
}