Search in sources :

Example 16 with XMLOutputter

use of org.jdom.output.XMLOutputter 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;
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Format(org.jdom.output.Format) NotNull(org.jetbrains.annotations.NotNull)

Example 17 with XMLOutputter

use of org.jdom.output.XMLOutputter in project intellij-plugins by JetBrains.

the class StringUtil method toXML.

public static String toXML(Throwable e) {
    @NonNls Element element = new Element("exception", Transport.NAMESPACE);
    if (e.getMessage() != null) {
        element.setAttribute("message", e.getMessage());
    }
    StringWriter out = new StringWriter();
    e.printStackTrace(new PrintWriter(out));
    element.setText(out.toString());
    return new XMLOutputter().outputString(element);
}
Also used : NonNls(org.jetbrains.annotations.NonNls) XMLOutputter(org.jdom.output.XMLOutputter) StringWriter(java.io.StringWriter) Element(org.jdom.Element) PrintWriter(java.io.PrintWriter)

Example 18 with XMLOutputter

use of org.jdom.output.XMLOutputter in project intellij-plugins by JetBrains.

the class SendXmlMessageP2PCommand method createNetworkMessage.

public static Message createNetworkMessage(final XmlMessage message) {
    Element element = new Element(message.getTagName(), message.getTagNamespace());
    message.fillRequest(element);
    return new P2PNetworkXmlMessage(new XMLOutputter().outputString(element), message);
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Element(org.jdom.Element)

Example 19 with XMLOutputter

use of org.jdom.output.XMLOutputter in project intellij-plugins by JetBrains.

the class SendXmlMessageP2PCommand method incomingMessage.

public String incomingMessage(String remoteUser, String messageText) {
    String xml = StringUtil.fromXMLSafeString(messageText);
    SAXBuilder builder = new SAXBuilder();
    try {
        Document document = builder.build(new StringReader(xml));
        Element rootElement = document.getRootElement();
        Element response = createResponse(rootElement, StringUtil.fromXMLSafeString(remoteUser));
        if (response == null)
            return "";
        return new XMLOutputter().outputString(response);
    } catch (Throwable e) {
        LOG.info(e.getMessage(), e);
        return StringUtil.toXML(e);
    }
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) SAXBuilder(org.jdom.input.SAXBuilder) Element(org.jdom.Element) StringReader(java.io.StringReader) Document(org.jdom.Document)

Example 20 with XMLOutputter

use of org.jdom.output.XMLOutputter in project intellij-plugins by JetBrains.

the class BaseExtension method toXML.

public String toXML() {
    Element root = new Element(getElementName());
    setupData(root);
    root.setNamespace(Namespace.getNamespace(getNamespace()));
    XMLOutputter outputter = new XMLOutputter();
    return outputter.outputString(root);
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Element(org.jdom.Element)

Aggregations

XMLOutputter (org.jdom.output.XMLOutputter)48 Element (org.jdom.Element)27 Document (org.jdom.Document)16 Format (org.jdom.output.Format)16 IOException (java.io.IOException)15 StringWriter (java.io.StringWriter)13 SAXBuilder (org.jdom.input.SAXBuilder)6 Writer (java.io.Writer)5 ArrayList (java.util.ArrayList)5 StringReader (java.io.StringReader)4 List (java.util.List)3 TreeMap (java.util.TreeMap)3 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)3 JDOMException (org.jdom.JDOMException)3 ElementFilter (org.jdom.filter.ElementFilter)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileOutputStream (java.io.FileOutputStream)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2