use of org.jdom.output.XMLOutputter in project vcell by virtualcell.
the class Translator method print.
private void print(Writer outStream, String printedDoc) throws IllegalStateException {
if ((printedDoc.equals("source") && sRoot == null) || (printedDoc.equals("target") && tRoot == null))
throw new IllegalStateException("Nothing to print.");
XMLOutputter xmlOut = new XMLOutputter();
// xmlOut.setNewlines(true);
try {
if (printedDoc.equals("source")) {
xmlOut.getFormat().setTextMode(Format.TextMode.TRIM_FULL_WHITE);
xmlOut.output(sRoot, outStream);
} else {
xmlOut.output(tRoot, outStream);
}
} catch (IOException e) {
System.err.println("Unable to write out XML file.");
e.printStackTrace();
}
}
use of org.jdom.output.XMLOutputter in project vcell by virtualcell.
the class BiomodelsDB_TestSuite method write.
private static void write(Document doc, File file) throws IOException {
PrintWriter reportFileWriter = new PrintWriter(file);
XMLOutputter outputter = new XMLOutputter();
outputter.getFormat().setLineSeparator("\n");
outputter.output(doc, reportFileWriter);
reportFileWriter.flush();
reportFileWriter.close();
}
use of org.jdom.output.XMLOutputter in project vcell by virtualcell.
the class VisMeshUtils method writeCellDataToVtu.
public static void writeCellDataToVtu(File inputMeshFile, String dataName, double[] data, File outputMeshFile) throws IOException {
Document meshDocument = XmlUtil.readXML(inputMeshFile);
addCellDataToVtuXml(meshDocument, dataName, data);
FileWriter fw = null;
try {
fw = new FileWriter(outputMeshFile);
XMLOutputter xmlOut = new XMLOutputter();
Format f = Format.getRawFormat();
f.setLineSeparator("\n");
f.setOmitEncoding(true);
f.setExpandEmptyElements(true);
xmlOut.setFormat(f);
xmlOut.output(meshDocument, fw);
} finally {
if (fw != null) {
fw.close();
}
}
}
use of org.jdom.output.XMLOutputter in project yamcs-studio by yamcs.
the class CopyPropertiesAction method run.
@Override
public void run() {
PropertiesSelectDialog dialog = new PropertiesSelectDialog(null, getSelectedWidgetModels().get(0));
if (dialog.open() == Window.OK) {
List<String> propList = dialog.getOutput();
if (!propList.isEmpty()) {
AbstractWidgetModel widget = getSelectedWidgetModels().get(0);
Element widgetElement = XMLUtil.widgetToXMLElement(widget);
Element propertisElement = new Element(PROPID_ELEMENT);
for (String propID : propList) {
propertisElement.addContent(new Element(propID));
}
Element rootElement = new Element(ROOT_ELEMENT);
rootElement.addContent(widgetElement);
rootElement.addContent(propertisElement);
XMLOutputter xmlOutputter = new XMLOutputter(Format.getRawFormat());
String xmlString = xmlOutputter.outputString(rootElement);
((OPIEditor) getWorkbenchPart()).getClipboard().setContents(new Object[] { xmlString }, new Transfer[] { PropertiesCopyDataTransfer.getInstance() });
}
}
}
Aggregations