Convert string into xml format
852806Jul 28 2011 — edited Jul 28 2011Hi All,
I am receiving the xml input to my bpel in the form of string.
I am converting that string input into xml format using the following code inside java embedding.
try
{
String input = (String)getVariableData("*xmlData*");
String root;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(input));
Document doc = db.parse(is);
root=doc.getDocumentElement().toString();
setVariableData("RootElement",root);
}
catch(Exception e)
{
setVariableData("RootElement",e.toString());
}
I also tried printing doc.toString (by assigning it to some variable. but i couldnt get the output as the document. I guess, there is some error in the conversion of the string to the xml document.
Kindly help me in this regard.
Thanks,
Sabarisri. N