Search in sources :

Example 1 with Document

use of org.apache.type_test.types1.Document in project gocd by gocd.

the class XmlView method renderMergedOutputModel.

protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
    Document document = (Document) model.get("document");
    ServletOutputStream outputStream = response.getOutputStream();
    try {
        XmlUtils.writeXml(document, outputStream);
    } finally {
        IOUtils.closeQuietly(outputStream);
    }
}
Also used : ServletOutputStream(javax.servlet.ServletOutputStream) Document(org.jdom2.Document)

Example 2 with Document

use of org.apache.type_test.types1.Document in project gocd by gocd.

the class GoControlLog method writeLogFile.

protected void writeLogFile(File file, Element element) throws IOException {
    // Write the log file out, let jdom care about the encoding by using
    // an OutputStream instead of a Writer.
    OutputStream logStream = null;
    try {
        Format format = Format.getPrettyFormat();
        XMLOutputter outputter = new XMLOutputter(format);
        IO.mkdirFor(file);
        file.setWritable(true);
        logStream = new BufferedOutputStream(new FileOutputStream(file));
        outputter.output(new Document(element), logStream);
    } finally {
        IO.close(logStream);
    }
}
Also used : XMLOutputter(org.jdom2.output.XMLOutputter) Format(org.jdom2.output.Format) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) Document(org.jdom2.Document) BufferedOutputStream(java.io.BufferedOutputStream)

Example 3 with Document

use of org.apache.type_test.types1.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_setsFormatTo1.

@Test
public void exportPreferences_setsFormatTo1() throws Exception {
    Document document = exportPreferences(false, Collections.<String>emptySet());
    assertEquals("1", document.getRootElement().getAttributeValue("format"));
}
Also used : Document(org.jdom2.Document) Test(org.junit.Test)

Example 4 with Document

use of org.apache.type_test.types1.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_setsVersionToLatest.

@Test
public void exportPreferences_setsVersionToLatest() throws Exception {
    Document document = exportPreferences(false, Collections.<String>emptySet());
    assertEquals(Integer.toString(Settings.VERSION), document.getRootElement().getAttributeValue("version"));
}
Also used : Document(org.jdom2.Document) Test(org.junit.Test)

Example 5 with Document

use of org.apache.type_test.types1.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_ignoresGlobalSettingsWhenRequested.

@Test
public void exportPreferences_ignoresGlobalSettingsWhenRequested() throws Exception {
    Document document = exportPreferences(false, Collections.<String>emptySet());
    assertNull(document.getRootElement().getChild("global"));
}
Also used : Document(org.jdom2.Document) Test(org.junit.Test)

Aggregations

Document (org.jdom2.Document)109 Element (org.jdom2.Element)74 SAXBuilder (org.jdom2.input.SAXBuilder)34 File (java.io.File)32 Test (org.junit.Test)29 DocType (org.jdom2.DocType)23 IOException (java.io.IOException)22 XMLOutputter (org.jdom2.output.XMLOutputter)20 JDOMException (org.jdom2.JDOMException)14 ProcessingInstruction (org.jdom2.ProcessingInstruction)13 XmlFile (jmri.jmrit.XmlFile)11 Document (com.google.cloud.language.v1beta2.Document)10 ApiException (com.google.api.gax.grpc.ApiException)9 Document (com.google.cloud.language.v1.Document)9 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)9 StatusRuntimeException (io.grpc.StatusRuntimeException)9 FileOutputStream (java.io.FileOutputStream)9 EncodingType (com.google.cloud.language.v1beta2.EncodingType)8 ArrayList (java.util.ArrayList)7 EncodingType (com.google.cloud.language.v1.EncodingType)6