Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 54976 invoked from network); 30 Sep 2009 20:49:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Sep 2009 20:49:32 -0000 Received: (qmail 42544 invoked by uid 500); 30 Sep 2009 20:49:32 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 42478 invoked by uid 500); 30 Sep 2009 20:49:32 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 42468 invoked by uid 99); 30 Sep 2009 20:49:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Sep 2009 20:49:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hhedin@gmail.com designates 209.85.219.210 as permitted sender) Received: from [209.85.219.210] (HELO mail-ew0-f210.google.com) (209.85.219.210) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Sep 2009 20:49:20 +0000 Received: by ewy6 with SMTP id 6so5250671ewy.6 for ; Wed, 30 Sep 2009 13:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=7EOCiKII/6wxuDTcjw+qG4NssKZTRNH+c0bDBqYIphg=; b=PAHqyC5i9aoPys0/iJkYjo4LTmGpjpye1RN5KSKt/xJA8Kkvhg1X1uxEN3w1tkWMxh wzjzLN1BKhNADHVa5+iH/Y43LxIvoU0ajxCIRGc7pCgJwN0mMHEGuDW8NXwP41LH4hDT YWHL3XHOnQ1yJDrPHgX5iReFDZmaP1UipVljQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=w5EDOHLX5iGoHNKlLZrhwyzZrnu5+V2xW3d6Wq3Rtbnls2qUEGw7FK2b3lftO6Fdd2 86BdBYwuN0v57XJrSUFb7NF8TOXaqYZw0ELS8rPhcjuwnx9MzB4Stwb3Ni77aGpJ47hE cJ0FbhFmkw8krsV4BcvtcBXxi78crgaq8T8Co= MIME-Version: 1.0 Received: by 10.216.88.212 with SMTP id a62mr66266wef.72.1254343739589; Wed, 30 Sep 2009 13:48:59 -0700 (PDT) In-Reply-To: <25682163.post@talk.nabble.com> References: <25681297.post@talk.nabble.com> <5380c69c0909300712s278f8b75vef8a644712c7a50c@mail.gmail.com> <25682163.post@talk.nabble.com> Date: Wed, 30 Sep 2009 22:48:59 +0200 Message-ID: <476cb3f50909301348o1c08588fxdb755d1d39b1f68c@mail.gmail.com> Subject: Re: Camel : file to Message - Error SAX "XML" Byte Order Mark (BOM) From: Henric Hedin To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0016e6d645590644500474d1a957 X-Virus-Checked: Checked by ClamAV on apache.org --0016e6d645590644500474d1a957 Content-Type: text/plain; charset=ISO-8859-1 Hi, I had a similar problem and performed a workaround where I removed the BOM characters in a Processor in my Camel Route. See code below. I'm not sure, but I think the problem is related to this bug in the JRE: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 Regards, Henric public class RemoveBomProcessor implements Processor { public void process(Exchange exchange) throws Exception { Object body = exchange.getIn(); if (body instanceof GenericFileMessage) { String content = ((GenericFileMessage) body).getBody(String.class); int startPosXml = new String(content).indexOf("= 0) { exchange.getIn().setBody(new String(content).substring(startPosXml)); } } } } On Wed, Sep 30, 2009 at 4:28 PM, titexe wrote: > > Firstly, thank you for your response and responsiveness. > > my camel platform receives files from different applications that generate > this type of xml file. > > I should be able to handle normal xml files and xml files with (BOM) > > there's a solution to solve this problem by a configuration in camel ? > > Thank you in advance > > > Claus Ibsen-2 wrote: > > > > Hi > > > > Use a text editor that do NOT set that BOM character. > > Or maybe your existing text editor can save in UTF-8 without the BOM. > > > > > > > > On Wed, Sep 30, 2009 at 3:42 PM, titexe > > > wrote: > >> > >> Hello, > >> > >> i have developped Camel route to transfrom file to message in queue > >> > >> This is my configuration: > >> > >> >> xmlns="http://activemq.apache.org/camel/schema/spring"> > >> > >> >> > uri="file:///c:/to_SAP/?consumer.recursive=true&consumer.alwaysConsume=true"/> > >> > >> > >> > >> > >> > >> This error is received only in the case of some xml file,when i edit > >> these > >> files, I detected that there's (BOM) byte order mark. > >> > >> [Fatal Error] :1:1: Content is not allowed in prolog. > >> DEBUG DefaultExceptionPolicyStrategy - Finding best suited exception > >> policy > >> for thrown exception org.xml.sax.SAXParseException > >> DEBUG DefaultExceptionPolicyStrategy - No candidate found to be used as > >> exception policy > >> DEBUG DefaultExceptionPolicyStrategy - Finding best suited exception > >> policy > >> for thrown exception org.apache.camel.RuntimeCamelException > >> DEBUG DefaultExceptionPolicyStrategy - No candidate found to be used as > >> exception policy > >> ERROR DeadLetterChannel - Failed delivery for exchangeId: > >> ID-DCFR/4624-1254314223390/0-4155. On delivery attempt: 3 caught: > >> org.apache.ca > >> mel.RuntimeCamelException: org.xml.sax.SAXParseException: Content is not > >> allowed in prolog. > >> org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException: > >> Content is not allowed in prolog. > >> at > >> org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:567) > >> at > >> > org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:57) > >> at > >> > org.apache.camel.impl.converter.DefaultTypeConverter.doConvertTo(DefaultTypeConverter.java:119) > >> at > >> > org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:90) > >> at > >> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:79) > >> at > >> org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:52) > >> at > >> > org.apache.camel.builder.xml.XPathBuilder.getDocument(XPathBuilder.java:536) > >> at > >> > org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:428) > >> at > >> org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:106) > >> at > >> org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:65) > >> at > >> > org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47) > >> at > >> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:80) > >> at > >> > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:189) > >> at > >> > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:133) > >> at > >> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68) > >> at > >> > org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87) > >> at > >> > org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82) > >> at > >> > org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52) > >> at > >> > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41) > >> at > >> > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66) > >> at > >> > org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:72) > >> at > >> > org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531) > >> at > >> > org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466) > >> at > >> > org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435) > >> at > >> > org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:3 > >> 22) > >> > >> version activemq : fuse message broker 5.3.0.3 > >> version java : Java 1.6 > >> > >> Than you in advance to help to resolve this problem, > >> > >> Best regards, > >> > >> titexe > >> -- > >> View this message in context: > >> > http://www.nabble.com/Camel-%3A-file-to-Message---Error-SAX-%22XML%22-Byte-Order-Mark-%28BOM%29-tp25681297p25681297.html > >> Sent from the Camel - Users mailing list archive at Nabble.com. > >> > >> > > > > > > > > -- > > Claus Ibsen > > Apache Camel Committer > > > > Open Source Integration: http://fusesource.com > > Blog: http://davsclaus.blogspot.com/ > > Twitter: http://twitter.com/davsclaus > > > > > > -- > View this message in context: > http://www.nabble.com/Camel-%3A-file-to-Message---Error-SAX-%22XML%22-Byte-Order-Mark-%28BOM%29-tp25681297p25682163.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > --0016e6d645590644500474d1a957--