I found the error. In my case I had ýp (Hex FF FE which is a unicode marker)
that my Editor (Ultraedit) was inserting.
James.Strachan wrote:
>
> Are you sure the XML file is valid? e.g. there's no newlines before
> the <?xml prolog?
>
> 2008/7/15 cmoulliard <[EMAIL PROTECTED]>:
>>
>> I had an error when I use Flatpack :
>>
>> 55891 [Thread: 1 [EMAIL PROTECTED]
>> ERROR org.apache.camel.processor.DeadLetterChannel - Failed delivery for
>> exchangeId: ID-dell-charles/4143-1216120045671/0-0. On delivery attempt:
>> 5
>> caught: net.sf.flatpack.InitialisationException:
>> org.jdom.input.JDOMParseException: Error on line 1 of document file:///:
>> Content is not allowed in prolog.
>> 43net.sf.flatpack.InitialisationException:
>> org.jdom.input.JDOMParseException: Error on line 1 of document file:///:
>> Content is not allowed in prolog.
>> at
>> net.sf.flatpack.FixedLengthParser.init(FixedLengthParser.java:118)
>> at net.sf.flatpack.AbstractParser.parse(AbstractParser.java:111)
>> at
>> org.apache.camel.component.flatpack.FlatpackProducer.process(FlatpackProducer.java:38)
>> at
>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
>> at
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:75)
>> at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
>> at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
>> at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
>> at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
>> at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
>> at
>> org.apache.camel.component.file.FileConsumer.pollFile(FileConsumer.java:128)
>> at
>> org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:77)
>> at
>> org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:84)
>> at
>> org.apache.camel.component.file.FileConsumer.poll(FileConsumer.java:57)
>> at
>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:65)
>> at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
>> at
>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
>> at
>> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
>> 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)
>> Caused by: org.jdom.input.JDOMParseException: Error on line 1 of document
>> file:///: Content is not allowed in prolog.
>> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:465)
>> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:875)
>> at net.sf.flatpack.xml.MapParser.parse(MapParser.java:139)
>> at net.sf.flatpack.xml.MapParser.parseMap(MapParser.java:278)
>> at
>> net.sf.flatpack.FixedLengthParser.init(FixedLengthParser.java:107)
>> ... 23 more
>> Caused by: org.xml.sax.SAXParseException: Content is not allowed in
>> prolog.
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>> at
>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>> at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
>> ... 27 more
>>
>> Here is the content of my route
>>
>>
>> from("file:///c:/temp/cutas/?delete=false&lock=true&consumer.delay=500&consumer.initialDelay=10")
>>
>> .to("flatpack:fixed:com/company/transformation/in/CUTAS-ST.pzmap.xml");
>>
>>
>>
>> from("flatpack:fixed:com/company/cutas/transformation/in/CUTAS-ST.pzmap.xml")
>> .convertBodyTo(Map.class)
>> .to("activemq:queue:cutas.in.queue");
>>
>> and xml file
>>
>> <?xml version='1.0'?>
>> <!DOCTYPE PZMAP SYSTEM "flatpack.dtd" >
>>
>> <PZMAP>
>> <RECORD id="header" startPosition="1" endPosition="3"
>> indicator="HBT">
>> <COLUMN name="INDICATOR" length="3" />
>> <COLUMN name="HEADERDATA" length="26" />
>> </RECORD>
>> <COLUMN name="RECORDTYPE" length="1" />
>> <COLUMN name="SYSTEMID" length="3" />
>> <COLUMN name="THIRDPARTYREF" length="15" />
>> <COLUMN name="DATA" length="472" />
>> <RECORD id="trailer" startPosition="1" endPosition="3"
>> indicator="FBT">
>> <COLUMN name="INDICATOR" length="3" />
>> <COLUMN name="TRAILERDATA" length="26" />
>> </RECORD>
>>
>> </PZMAP>
>>
>> The problem is not at all related to Camel but any help would be
>> appreciate.
>>
>> Regards,
>>
>> Charles
>>
>>
>>
>> Claus Ibsen wrote:
>>>
>>> Hi
>>>
>>> Yes I thought also at first it was a dataformat ;) But how James created
>>> it it works as if it is a dataformat. You just have to do it in to..from
>>> from..to steps.
>>>
>>>
>>> from("file://c:/test").to("flatpack:foo:
>>> locationOftheXMLConfigurationfile.pzmap.xml");
>>>
>>> from("flatpack:foo").to("whatever you want");
>>>
>>> As a component it gets more attention, as people can find it on the
>>> component list. The dataformats are kinda hidden in the wiki
>>> documentation.
>>> Maybe they need a "dataformat" top menu as well ;)
>>>
>>> Med venlig hilsen
>>>
>>> Claus Ibsen
>>> ......................................
>>> Silverbullet
>>> Skovsgårdsvænget 21
>>> 8362 Hørning
>>> Tlf. +45 2962 7576
>>> Web: www.silverbullet.dk
>>>
>>> -----Original Message-----
>>> From: cmoulliard [mailto:[EMAIL PROTECTED]
>>> Sent: 15. juli 2008 09:32
>>> To: [email protected]
>>> Subject: Re: Component to read FixedLength file ?
>>>
>>>
>>> Many thanks.
>>>
>>> I will test the integration of this component within Camel.
>>>
>>> Remark : I'm a little confused about how Flatpack has been integrated.
>>> The
>>> project has been integrated like a component but from my point of view,
>>> it
>>> should be integrated (for consistency reason) like a Dataformat. Because
>>> like the other framework/technology implemented in Camel (JAXB, Artix,
>>> XStream, ....), they transform the content from a format (XML, CSV, ...)
>>> into another format (Collection of Java objects)
>>>
>>> E.g.
>>>
>>> DataFormat flatpack = new
>>> DataFormat("locationOftheXMLConfigurationfile.pzmap.xml.xml")
>>>
>>> from("file:///c:/test")
>>> .unmarshall(flatpack)
>>> .to("whatever you want")
>>>
>>> Regards,
>>>
>>> Charles
>>>
>>>
>>>
>>> James.Strachan wrote:
>>>>
>>>> BTW trunk has an early spike of a flatpack component. Needs more work,
>>>> but there's a basic fixed-width reader example there for the curious
>>>>
>>>> 2008/7/14 James Strachan <[EMAIL PROTECTED]>:
>>>>> I've raised a JIRA to track this...
>>>>> https://issues.apache.org/activemq/browse/CAMEL-717
>>>>>
>>>>> 2008/7/14 James Strachan <[EMAIL PROTECTED]>:
>>>>>> 2008/7/14 cmoulliard <[EMAIL PROTECTED]>:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is there a component expected to read fixedlength files in Camel
>>>>>>> like
>>>>>>> flatpack (http://flatpack.sourceforge.net/) allow to do it ?
>>>>>>
>>>>>> It should be pretty easy to write a flatpack component.
>>>>>>
>>>>>> there's a commercial tool called Artix Data Services which comes with
>>>>>> a nice design UI that does this with Camel...
>>>>>> http://activemq.apache.org/camel/artix-data-services.html
>>>>>>
>>>>>> but it'd be nice to have an OSS option :)
>>>>>>
>>>>>> --
>>>>>> James
>>>>>> -------
>>>>>> http://macstrac.blogspot.com/
>>>>>>
>>>>>> Open Source Integration
>>>>>> http://open.iona.com
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> James
>>>>> -------
>>>>> http://macstrac.blogspot.com/
>>>>>
>>>>> Open Source Integration
>>>>> http://open.iona.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>>
>>>> Open Source Integration
>>>> http://open.iona.com
>>>>
>>>>
>>>
>>>
>>> -----
>>> Enterprise Architect
>>>
>>> Xpectis
>>> 12, route d'Esch
>>> L-1470 Luxembourg
>>>
>>> Phone +352 25 10 70 470
>>> Mobile +352 621 45 36 22
>>>
>>> e-mail : [EMAIL PROTECTED]
>>> web site : www.xpectis.com
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Component-to-read-FixedLength-file---tp18444614s22882p18459545.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : [EMAIL PROTECTED]
>> web site : www.xpectis.com
>> --
>> View this message in context:
>> http://www.nabble.com/Component-to-read-FixedLength-file---tp18444614s22882p18462576.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com
>
>
-----
Enterprise Architect
Xpectis
12, route d'Esch
L-1470 Luxembourg
Phone +352 25 10 70 470
Mobile +352 621 45 36 22
e-mail : [EMAIL PROTECTED]
web site : www.xpectis.com
--
View this message in context:
http://www.nabble.com/Component-to-read-FixedLength-file---tp18444614s22882p18466472.html
Sent from the Camel - Users mailing list archive at Nabble.com.