Question Mark's appearing in MS word document Generated using XML, XSL FO and jFor
posted 11 years ago
Hi all, We are getting a strange problem while generating a word document (*.rtf) and displaying that in the client browser. In offshore , we are using SunOne ApplicationServer 7 on Windows 2000 and we are not facing any Problem. In Onsite , its on SunOne ApplicationServer 7 on SunSolaris and we are getting the problem over there.
The final XML has <?xml version='1.0' encoding='ISO-8859-1'?> <![CDATA[Address 1#4]]> - CDATA Enclosed for all the data.
We are follwing the below steps to generate the .rtf Document.
1> Fetch the XML from the from the database which is in a CLOB format. 2> Convert that to XML using to an user defined object using xerces DOMParser. 3> Transforming the XML and XSL using xmlParserAPIs. 4> Converting that to RTF documet using jFor CmdLineConverter. 5> Flusing the content into Response.
We are also getting "?" in the pls find the code below. StringBuffer strFinalXml = getFinalXMLStringForPublish(documentObj);
File xslFile = new File(ETClsWebAppProperties.getProperty(ETClsWebAppProperties.XSL_FOR_RTF)); Source xslSource = new StreamSource(xslFile); Source xmlSource = new StreamSource(new StringReader(strFinalXml.toString())); logWriter.fatal("complete xml file " + strFinalXml.toString()); TransformerFactory transformFact = TransformerFactory.newInstance(); //store result here ByteArrayOutputStream outStream = new ByteArrayOutputStream(); Result result = new StreamResult(outStream); Transformer trans = transformFact.newTransformer(xslSource); trans.transform(xmlSource, result);