• 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
Posts: 16
  • 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());

// 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);
size = bis.read(arr);

} // if wording generated

Can anyone help us in the above regards.

Mohan Mani
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!