예제 #1
0
  public static String domToString(Node node) {
    try {
      Transformer transformer = TransformerUtils.getXMLIdentityTransformer();
      DOMSource source = new DOMSource(node);

      StringBuilderWriter writer = new StringBuilderWriter();
      transformer.transform(source, new StreamResult(writer));
      return writer.toString();
    } catch (TransformerException e) {
      throw new OXFException(e);
    }
  }
예제 #2
0
 public static String readStreamAsString(Reader reader) throws IOException {
   final StringBuilderWriter writer = new StringBuilderWriter();
   copyStream(reader, writer);
   return writer.toString();
 }