What I have done is extracted an XML file data and posted it in a ActiveMQ Queue. Now I have to retrieve the data from ActiveMQ queue and create a XML file in a folder? Same thing I have done with the HTM file. Extracted the HTML data and posted in queue. Now I have to create a HTM file in a folder. The problem is creating the XML file exactly it was. During posting request to queue I have converted XML and HTM file data to mule message in the following manner and then posted in queue-
'<'filename'>'XML_FILE_NAME'<'/filename'>' '<'filedata'>'XML_FILE_DATA'<'/filedata'>'
'<'filename'>'HTM_FILE_NAME'<'/filename'>' '<'filedata'>'HTM_FILE_DATA'<'/filedata'>'
For HTM file creation it gives error :-
**"[Fatal Error] :101:3: The element type "meta" must be terminated by the matching end-tag "" ERROR 2015-06-17 10:08:03,476 [ActiveMQ Session Task-1] org.mule.exception.CatchMessagingExceptionStrategy:
Message : org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "". (javax.xml.transform.TransformerException) Code : MULE_ERROR--2 --------------------------------------------------------------------------------"**
Meta tag in HTM file should be created with this tag exactly as it was.
How can these be resolved?
When you're handling HTML files that can't validate as XML, try to transform them directly to strings or byte-arrays instead. Byte-arrays is preferable when putting it on a queue.
Once you've read the message from the queue, transform the byte-array to a string and log it's #[payload] to verify that you have the correct data so far.
Then you just have to use a file outbound-endpoint to store the data in a file. You can configure the directory it should write to directly in it's properties.