示例#1
0
  @Override
  public String toString() {
    Document document = drawer.toSVG(diagram);

    // Use the old transformer method as we cannot be guaranteed that
    // the underlying JDK supports DOM level 3.
    try {
      Source source = new DOMSource(document.getDocumentElement());
      StringWriter stringWriter = new StringWriter();
      Result result = new StreamResult(stringWriter);
      TransformerFactory factory = TransformerFactory.newInstance();
      Transformer transformer = factory.newTransformer();
      transformer.transform(source, result);
      return stringWriter.getBuffer().toString();
    } catch (TransformerConfigurationException e) {
      e.printStackTrace();
    } catch (TransformerException e) {
      e.printStackTrace();
    }
    return null;
  }
示例#2
0
 public SVGDocument toSVG() {
   return drawer.toSVG(diagram);
 }