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-tp19538474p19538474.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to