コード例 #1
0
 private void test(Node node, String string, Prologue prologue2) {
   try {
     ByteArrayOutputStream bytes = new ByteArrayOutputStream();
     Writer w = new OutputStreamWriter(bytes, "ASCII");
     OutputLangUtils.output(w, node, prologue);
     w.flush();
     String str = bytes.toString("ASCII");
     assertEquals(string, str);
   } catch (UnsupportedEncodingException ex) {
     ex.printStackTrace();
   } catch (IOException ex) {
     ex.printStackTrace();
   }
 }
コード例 #2
0
 private static String stringForNode(String nodeStr, Prologue prologue, String encoding) {
   Node node = NodeFactory.parseNode(nodeStr);
   try {
     ByteArrayOutputStream bytes = new ByteArrayOutputStream();
     Writer w = new OutputStreamWriter(bytes, encoding);
     OutputLangUtils.output(w, node, prologue);
     w.flush();
     return bytes.toString(encoding);
   } catch (UnsupportedEncodingException ex) {
     ex.printStackTrace();
   } catch (IOException ex) {
     ex.printStackTrace();
   }
   return null;
 }