Ok! Got a Solution!
Used StringWriter to hold the XML DOM tree and used it as input to SAX InputSource.
 
      DOMSource objXMLSource = new DOMSource(sourceDocument);
      StringWriter stringOut = new StringWriter();
      StreamResult objResultStream = new StreamResult(stringOut);
      Transformer objTransformer = TransformerFactory.newInstance().newTransformer();
      objTransformer.transform(objXMLSource, objResultStream);
      String xmlString = stringOut.toString();
      ByteArrayInputStream stream =    new ByteArrayInputStream(xmlString.getBytes());
      InputSource is = new InputSource(stream);
 
Regards
Prasanna Kumar

-----Original Message-----
From: Prasanna Kumar AG [mailto:[EMAIL PROTECTED]
Sent: Friday, February 14, 2003 5:00 PM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: DOM to SAX InputSource

Hi All,
Is there any way by which I can generate SAX InputSource from a org.w3c.dom.Document object, without generating temporary XML file.
I am using iText library to generate PDF from an XML source. As an XML Source I have a Document object. But the iText library only supports input in the form of  SAX InputSource.
 
Any suggestions?
 
Thanks,
Prasanna Kumar
Virtusa India Pvt. Ltd.,
Phone : (+91)-40-3414200 ext 220
[EMAIL PROTECTED]
www.virtusa.com
 

Reply via email to