Saxon is currently not able to set the output of the transformation into an attachement. This would be a nice addition, so please raise a JIRA.
In the mean time, I would change the XSLT so that the text is embedded in a simple xml tag: <data> content of the text data here</data> and I would write a simple file marshaler that would grab this data from the xml and write it. Actually, such a simple marshaler would be a good addition too, so if you ever write it, please raise a JIRA and attach your code (test cases are welcome too). On Thu, Sep 18, 2008 at 3:40 PM, NeenaMathew <[EMAIL PROTECTED]> wrote: > > Hi > > I tried setting the result attribute to string in saxon endpoint. Then I am > getting the following error. Actullay I want to sftp the text file generated > from saxon.. So My file component is giving me the following error. > > Here is my xbean fro saxon-endpoint > > <beans xmlns:saxon="http://servicemix.apache.org/saxon/1.0" > xmlns:first="http://servicemix.apache.com/first"> > <!-- START SNIPPET: xslt --> > <saxon:xslt service="first:xslt" endpoint="endpoint" > resource="classpath:transform.xsl" result="string"/> > <!-- END SNIPPET: xslt --> > </beans> > > here is my file component xbean > > <file:sender service="first:fileProduction" > endpoint="senderProd" > directory="c:/test/servicemix/out" > > <property name="marshaler"> > <bean > > class="org.apache.servicemix.components.util.BinaryFileMarshaler" > > </bean> > </property> > </file:sender> > > [Fatal Error] :1:1: Content is not allowed in prolog. > [Fatal Error] :1:1: Content is not allowed in prolog. > ERROR - FileComponent - Error processing exchange InOnly[ > id: ID:172.24.44.33-11c75a7186a-9:4 > status: Active > role: provider > service: {http://servicemix.apache.com/first}fileProduction > endpoint: senderProd > in: Unable to display: org.xml.sax.SAXParseException: Content is not > allowed in prolog. > ] > javax.jbi.messaging.MessagingException: Could not find attachment: content > at > org.apache.servicemix.components.util.BinaryFileMarshaler.writeMessage(BinaryFileMarshale > r.java:78) > at > org.apache.servicemix.file.FileSenderEndpoint.processInOnly(FileSenderEndpoint.java:86) > at > org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEndpoint.java:100 > ) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:540) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:4 > 92) > at > org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46) > at > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImp > l.java:610) > at > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172) > at > org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167) > at > org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) > at java.lang.Thread.run(Thread.java:595) > > Thanks > Neena > > > splatch wrote: >> >> Did you try result attribute for saxon enpoint? >> At the http://servicemix.apache.org/servicemix-saxon.html page with >> warning about this saxon bug: >> http://sourceforge.net/tracker/index.php?func=detail&aid=1558133&group_id=29872&atid=397617. >> >> This should help you transform message without bean endpoint. >> >> Regards, >> Luke >> >> >> NeenaMathew wrote: >>> >>> Hi >>> >>> I want create a text file out of the XML content. When I try to use >>> servicemix-saxon component the transformed content is placed in the body >>> of the Message and I am getting the error from servicemix that it is not >>> valid xml. How can I specify theat the output is not xml but text and >>> attach it part of the message no as the content of the message to saxon >>> component. >>> >>> Currently I wrote a servicemix-bean component to which takes the xml >>> content from the message and call the saxon to do the transformation to >>> text and atatch the text in the message. Is the right way to do the xml >>> to text transformation? >>> >>> NormalizedMessage message = exchange.getMessage("in"); >>> Source content = message.getContent(); >>> NormalizedMessage outMessage = exchange.createMessage(); >>> outMessage.setContent(content); >>> /* >>> * Transform the incomeing xml message in to the text content >>> */ >>> ByteArrayOutputStream out = XMLTransformer.getInstance().transform( >>> content, xslt); >>> >>> DataSource ds = new ByteArrayDataSource(out.toByteArray(), null); >>> DataHandler handler = new DataHandler(ds); >>> outMessage.addAttachment("content", handler); >>> String fileName = "lms_Funds_" + System.currentTimeMillis() >>> + ".txt"; >>> outMessage.setProperty(FILE_NAME_PROPERTY, fileName); >>> exchange.setMessage(outMessage, "out"); >>> channel.send(exchange) >>> >> >> > > -- > View this message in context: > http://www.nabble.com/Servicemix-saxon-comonent-to-transform-the-xml-to-text-tp19538474p19553162.html > Sent from the ServiceMix - User mailing list archive at Nabble.com. > > -- Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/ ------------------------ Open Source SOA http://open.iona.com
