Search in sources :

Example 81 with Document

use of org.jdom2.Document in project gocd by gocd.

the class FullConfigSaveFlow method toXmlString.

protected String toXmlString(CruiseConfig configForEdit) throws Exception {
    Document document = documentFrom(configForEdit);
    validateDocument(document);
    return toXmlString(document);
}
Also used : Document(org.jdom2.Document)

Example 82 with Document

use of org.jdom2.Document in project gocd by gocd.

the class FullConfigSaveFlow method documentFrom.

protected org.jdom2.Document documentFrom(CruiseConfig configForEdit) {
    LOGGER.debug("[Config Save] Building Document from CruiseConfig object: Starting.");
    Document document = writer.documentFrom(configForEdit);
    LOGGER.debug("[Config Save] Building Document from CruiseConfig object: Done.");
    return document;
}
Also used : Document(org.jdom2.Document)

Example 83 with Document

use of org.jdom2.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_exportsGlobalSettingsWhenRequested.

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

Example 84 with Document

use of org.jdom2.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_producesXML.

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

Example 85 with Document

use of org.jdom2.Document in project k-9 by k9mail.

the class SettingsExporterTest method parseXML.

private Document parseXML(byte[] xml) throws Exception {
    SAXBuilder builder = new SAXBuilder();
    InputStream stream = new ByteArrayInputStream(xml);
    return builder.build(stream);
}
Also used : SAXBuilder(org.jdom2.input.SAXBuilder) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream)

Aggregations

Document (org.jdom2.Document)86 Element (org.jdom2.Element)76 Test (org.junit.Test)33 File (java.io.File)29 DocType (org.jdom2.DocType)24 SAXBuilder (org.jdom2.input.SAXBuilder)21 IOException (java.io.IOException)16 XMLOutputter (org.jdom2.output.XMLOutputter)15 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 ArrayList (java.util.ArrayList)9 EncodingType (com.google.cloud.language.v1beta2.EncodingType)8 FileOutputStream (java.io.FileOutputStream)8 JLabel (javax.swing.JLabel)7 EncodingType (com.google.cloud.language.v1.EncodingType)6