I need some help. In my String
filedata variable I stored an XMLdocument. Now I want to convert this variable to a DOMSource
type and use this code:
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = db.parse( new InputSource( new StringReader( filedata ) ) );
DOMSource source = new DOMSource(doc);
and transform by javax.xml.transform.Transformer :
Transformer transformer = XMLTransformerFactory.getTransformer(messageType);
StreamResult res = new StreamResult(flatXML);
transformer.transform(source, res);
But my flatXML is empty after transformation. I checked my doc variable, and it contains my XML document and parsed everything right. If I change my source to the real path everything is ok and works fine :
Source source = new StreamSource("c:\\temp\\log\\SMKFFcompleteProductionPlan.xml");
I think my problem situated in this line of code :
DOMSource source = new DOMSource(doc);
but I don't know how to solve this problem.