Hi all,
I have created one InputSource object and using that object I have transform the Source into result. The code I used is below :
Thanks in advance..
I have created one InputSource object and using that object I have transform the Source into result. The code I used is below :
Code:
DocumentBuilderFactory dbfac1 = DocumentBuilderFactory
.newInstance();
DocumentBuilder dbparser1 = dbfac1.newDocumentBuilder();
Document doc1 = dbparser1.parse(new File("source.xml"));
DOMSource dm1 = new DOMSource(doc1);
InputSource ss1 = SAXSource.sourceToInputSource(dm1);
// This is the usual way of transform(). Instead of using DOMSource
// as argument, somehow I have to incorporate InputSource obj
// created above i.e. ss1.
SAXTransformerFactory stf1 = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
Transformer t1 = stf1.newTransformer();
t1.transform(dm1,new StreamResult(new
FileOutputStream(output1)));
Comment