use of org.jdom.output.Format in project intellij-community by JetBrains.
the class EditorColorSchemeTestCase method assertXmlOutputEquals.
protected static void assertXmlOutputEquals(String expected, Element root) throws IOException {
StringWriter writer = new StringWriter();
Format format = Format.getPrettyFormat();
format.setLineSeparator("\n");
new XMLOutputter(format).output(root, writer);
String actual = writer.toString();
assertEquals(expected, actual);
}
use of org.jdom.output.Format in project intellij-community by JetBrains.
the class JDOMUtil method createOutputter.
@NotNull
public static XMLOutputter createOutputter(String lineSeparator) {
XMLOutputter xmlOutputter = new MyXMLOutputter();
Format format = Format.getCompactFormat().setIndent(" ").setTextMode(Format.TextMode.TRIM).setEncoding(CharsetToolkit.UTF8).setOmitEncoding(false).setOmitDeclaration(false).setLineSeparator(lineSeparator);
xmlOutputter.setFormat(format);
return xmlOutputter;
}
use of org.jdom.output.Format in project intellij-community by JetBrains.
the class XMLOutputterTest method printElement.
private String printElement(Element root) throws IOException {
XMLOutputter xmlOutputter = JDOMUtil.createOutputter("\n");
final Format format = xmlOutputter.getFormat().setOmitDeclaration(true).setOmitEncoding(true).setExpandEmptyElements(true);
xmlOutputter.setFormat(format);
CharArrayWriter writer = new CharArrayWriter();
xmlOutputter.output(root, writer);
String res = new String(writer.toCharArray());
return res;
}
use of org.jdom.output.Format in project intellij-community by JetBrains.
the class ArrangementSettingsSerializationTest method assertXmlOutputEquals.
private static void assertXmlOutputEquals(String expected, Element root) throws IOException {
StringWriter writer = new StringWriter();
Format format = Format.getPrettyFormat();
format.setLineSeparator("\n");
new XMLOutputter(format).output(root, writer);
String actual = writer.toString();
assertEquals(expected, actual);
}
use of org.jdom.output.Format in project intellij-community by JetBrains.
the class SerializableSchemeExporter method writeToStream.
private static void writeToStream(@NotNull OutputStream outputStream, @NotNull Element element) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
Format format = Format.getPrettyFormat();
format.setLineSeparator("\n");
new XMLOutputter(format).output(element, writer);
}
Aggregations