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;
}
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);
}
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);
}
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);
}
}
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);
}
Aggregations