Search This Blog

Tuesday, November 19, 2013

How to print the XML data for a variable in BPEL

 

You can use the following java embedded  code 

try { 
  System.out.println("+++++++ Printing XML Variables ++++++++++ (Start) "+getInstanceId());  
    oracle.xml.parser.v2.XMLElement input = (oracle.xml.parser.v2.XMLElement) getVariableData("transactionDataArray");  
  System.out.println(" ++++ qname "+input.getQualifiedName() );  
javax.xml.transform.TransformerFactory tfactory = javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer xform = tfactory.newTransformer();
javax.xml.transform.dom.DOMSource src = new  javax.xml.transform.dom.DOMSource(input);
java.io.StringWriter writer = new java.io.StringWriter();
javax.xml.transform.Result  result = new javax.xml.transform.stream.StreamResult(writer);
xform.transform(src, result);
System.out.println(writer.toString());
  System.out.println("+++++++ Printing XML Variables ++++++++++ (End) "+getInstanceId());
} catch (Exception e) {  
  System.out.println("exception "+e.getMessage());  
}

This will print the XML string for an variable.

No comments: