This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question Mark's appearing in MS word document Generated using XML, XSL FO and jFor

 
Mohan Mani
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);

logWriter.fatal("OutPut Stream - 1 " + outStream.toString());
ByteArrayInputStream bInputStream = new ByteArrayInputStream(outStream.toByteArray());

logWriter.fatal("OutPut Stream - 2 " + outStream.toString());

CmdLineConverter rtfGenerator = new CmdLineConverter();
outStream = (ByteArrayOutputStream)rtfGenerator.rtfConverter(bInputStream);
logWriter.fatal("OutPut Stream - 3 " + outStream.toString());

response.setContentType("application/msword");
//response.setHeader("Cache-Control","no-cache");
//response.setHeader("Pragma","no-cache");
// set the content disposition .
response.setHeader("Content-Disposition", "inline;filename=Document" + objSelectedListDocument.getDispDocumentNo() + "-" + objSelectedListDocument.getDispRevId() + ".rtf");
OutputStream resOS = response.getOutputStream();
ByteArrayInputStream bis = new ByteArrayInputStream(outStream.toByteArray());
byte[] arr = new byte[1024];
int size = bis.read(arr);
while (size != -1) {
resOS.write(arr, 0, size);
resOS.flush();
size = bis.read(arr);
}

} // if wording generated

Can anyone help us in the above regards.

Regards
Mohan Mani
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic