// get processdata
ProcessData data = process.processContext();
Object value = data.get("result");
if (value != null) {
SAXEventBufferImpl myBuffer
= (SAXEventBufferImpl)value;
TransformerFactory tf
= TransformerFactory.newInstance();
SAXTransformerFactory saxTransFact = null;
if (tf.getFeature(SAXTransformerFactory.FEATURE)) {
saxTransFact = (SAXTransformerFactory)tf;
}
TransformerHandler transHand = null;
transHand = saxTransFact.newTransformerHandler();
StreamResult streamResult = new StreamResult
(new java.io.ByteArrayOutputStream());
transHand.setResult(streamResult);
myBuffer.emit(transHand);
System.out.println(streamResult.getOutputStream().toString());
DOMResult domResult = new DOMResult();
transHand = saxTransFact.newTransformerHandler();
transHand.setResult(domResult);
myBuffer.emit(transHand);
Element returnResult = ((Document)domResult.getNode())
.getDocumentElement();
XPath xpath = new DOMXPath("/parent/firstChild");
String value2 = xpath.stringValueOf(returnResult);
assertTrue(value2.equals("I'm number one"));