use of org.jdom.output.XMLOutputter in project tdi-studio-se by Talend.
the class SOAPUtil method Doc2StringWithoutDeclare.
private String Doc2StringWithoutDeclare(Document doc) {
DOMBuilder builder = new DOMBuilder();
org.jdom.Document jdomDoc = builder.build(doc);
XMLOutputter outputter = new XMLOutputter();
return outputter.outputString(jdomDoc.getRootElement());
}
use of org.jdom.output.XMLOutputter in project intellij-plugins by StepicOrg.
the class StudySerializationUtilsTest method before.
@BeforeClass
public static void before() {
outputter = new XMLOutputter();
Format format = Format.getPrettyFormat().setLineSeparator("\n");
outputter.setFormat(format);
}
use of org.jdom.output.XMLOutputter in project beast-mcmc by beast-dev.
the class XMLModelCombiner method writeXML.
public void writeXML(OutputStream ostream) {
from.prefixIdentifiedNames("from", mapping.getFromNames(), true);
to.prefixIdentifiedNames("to", mapping.getToNames(), false);
XMLOutputter outputter = new XMLOutputter();
from.print(outputter, ostream);
to.print(outputter, ostream);
}
use of org.jdom.output.XMLOutputter in project sling by apache.
the class CreateKarafFeatureDescriptorMojo method executeWithArtifacts.
@Override
protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
Document doc = new Document();
Element features = new Element("features");
doc.setRootElement(features);
features.setAttribute("name", featuresName);
Element feature = new Element("feature");
features.addContent(feature);
feature.setAttribute("name", featureName);
feature.setAttribute("version", featureVersion);
BundleList bundleList = getInitializedBundleList();
for (StartLevel level : bundleList.getStartLevels()) {
for (Bundle bundle : level.getBundles()) {
String bundleRef = String.format("mvn:%s/%s/%s", bundle.getGroupId(), bundle.getArtifactId(), bundle.getVersion());
feature.addContent(new Element("bundle").setText(bundleRef));
}
}
FileOutputStream out = null;
try {
out = new FileOutputStream(outputFile);
new XMLOutputter(Format.getPrettyFormat().setEncoding("UTF-8")).output(doc, out);
projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
} catch (IOException e) {
throw new MojoExecutionException("Unable to write features.xml", e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
}
}
}
}
use of org.jdom.output.XMLOutputter in project beast-mcmc by beast-dev.
the class AntigenicPlotter method writeKML.
private void writeKML(String fileName, String[] labels, double[][][] data) {
int[] traceOrder = sortTraces(labels);
// Element hpdSchema = new Element("Schema");
// hpdSchema.setAttribute("id", "HPD_Schema");
// hpdSchema.addContent(new Element("SimpleField")
// .setAttribute("name", "Label")
// .setAttribute("type", "string")
// .addContent(new Element("displayName").addContent("Label")));
// hpdSchema.addContent(new Element("SimpleField")
// .setAttribute("name", "Point")
// .setAttribute("type", "double")
// .addContent(new Element("displayName").addContent("Point")));
// hpdSchema.addContent(new Element("SimpleField")
// .setAttribute("name", "Year")
// .setAttribute("type", "double")
// .addContent(new Element("displayName").addContent("Year")));
// hpdSchema.addContent(new Element("SimpleField")
// .setAttribute("name", "HPD")
// .setAttribute("type", "double")
// .addContent(new Element("displayName").addContent("HPD")));
Element traceSchema = new Element("Schema");
traceSchema.setAttribute("id", "Trace_Schema");
traceSchema.addContent(new Element("SimpleField").setAttribute("name", "Label").setAttribute("type", "string").addContent(new Element("displayName").addContent("Label")));
traceSchema.addContent(new Element("SimpleField").setAttribute("name", "Trace").setAttribute("type", "double").addContent(new Element("displayName").addContent("Trace")));
traceSchema.addContent(new Element("SimpleField").setAttribute("name", "Year").setAttribute("type", "double").addContent(new Element("displayName").addContent("Year")));
traceSchema.addContent(new Element("SimpleField").setAttribute("name", "State").setAttribute("type", "double").addContent(new Element("displayName").addContent("State")));
Element centroidSchema = new Element("Schema");
centroidSchema.setAttribute("id", "Centroid_Schema");
centroidSchema.addContent(new Element("SimpleField").setAttribute("name", "Label").setAttribute("type", "string").addContent(new Element("displayName").addContent("Label")));
centroidSchema.addContent(new Element("SimpleField").setAttribute("name", "Year").setAttribute("type", "double").addContent(new Element("displayName").addContent("Year")));
centroidSchema.addContent(new Element("SimpleField").setAttribute("name", "Trace").setAttribute("type", "double").addContent(new Element("displayName").addContent("Trace")));
// final Element contourFolderElement = new Element("Folder");
// Element contourFolderNameElement = new Element("name");
// contourFolderNameElement.addContent("HPDs");
// contourFolderElement.addContent(contourFolderNameElement);
final Element traceFolderElement = new Element("Folder");
Element traceFolderNameElement = new Element("name");
traceFolderNameElement.addContent("traces");
traceFolderElement.addContent(traceFolderNameElement);
final Element centroidFolderElement = new Element("Folder");
Element centroidFolderNameElement = new Element("name");
centroidFolderNameElement.addContent("centroids");
centroidFolderElement.addContent(centroidFolderNameElement);
Element documentNameElement = new Element("name");
String documentName = fileName;
if (documentName.endsWith(".kml"))
documentName = documentName.replace(".kml", "");
documentNameElement.addContent(documentName);
final Element documentElement = new Element("Document");
documentElement.addContent(documentNameElement);
documentElement.addContent(traceSchema);
documentElement.addContent(centroidSchema);
// documentElement.addContent(hpdSchema);
documentElement.addContent(centroidFolderElement);
documentElement.addContent(traceFolderElement);
// documentElement.addContent(contourFolderElement);
final Element rootElement = new Element("kml");
rootElement.addContent(documentElement);
Element traceElement = generateTraceElement(labels, data, traceOrder);
traceFolderElement.addContent(traceElement);
Element centroidElement = generateCentroidElement(labels, data, traceOrder);
centroidFolderElement.addContent(centroidElement);
// Element contourElement = generateKDEElement(0.95, labels, data, traceOrder);
// contourFolderElement.addContent(contourElement);
PrintStream resultsStream;
try {
resultsStream = new PrintStream(new File(fileName));
XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat().setTextMode(Format.TextMode.PRESERVE));
xmlOutputter.output(rootElement, resultsStream);
} catch (IOException e) {
System.err.println("Error opening file: " + fileName);
System.exit(-1);
}
}
Aggregations