web stats
Error reading xml file with filereader - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-21-2009, 05:43 AM
StefanScholte StefanScholte is offline
 
Join Date: May 2009
Location: Netherlands, Harderwijk
Posts: 321
StefanScholte is on a distinguished road
Default Error reading xml file with filereader

Hello

I have a curious problem:

I have a channel wich source connector is file reader wich reads xml files but and a destination to EDI.

When mirth reads in a xml file it gives the following error:

ERROR-301: Transformer conversion error
ERROR MESSAGE: Error adapting message
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
at ...

When I look in the raw message I see a "?" before the first xml tag like this:
?<EDIFACT2>

I'm absolutly sure there are no (strange) characters before the <EDIFACT2> tag.

I'm currently using Mirth Version 1.8.1.4211

I hope someone can help me.
Kind regards
Stefan Scholte
Reply With Quote
  #2  
Old 10-21-2009, 08:40 AM
EricD EricD is offline
Mirth Newb
 
Join Date: Oct 2009
Posts: 14
EricD is on a distinguished road
Default

It sounds like <EDIFACT2> is the first tag in your xml document. Proper XML files have an xml declaration as the first element (<?xml ... ?>)
Reply With Quote
  #3  
Old 10-21-2009, 10:12 PM
StefanScholte StefanScholte is offline
 
Join Date: May 2009
Location: Netherlands, Harderwijk
Posts: 321
StefanScholte is on a distinguished road
Default

Dear EricD,

I've tried that too but of no avail.

but when I copy the raw message (without the "?") and paste it into a new document this problem does not occur anymore.

My quess is that there must be a strange character that notepad can't "see" also other editors does not show this character.
Reply With Quote
  #4  
Old 10-23-2009, 01:39 AM
ajay_007 ajay_007 is offline
OBX.1 Kenobi
 
Join Date: Apr 2009
Posts: 26
ajay_007 is on a distinguished road
Default

Please check at first line . IS there any space before first tag?
Reply With Quote
  #5  
Old 10-23-2009, 03:11 AM
StefanScholte StefanScholte is offline
 
Join Date: May 2009
Location: Netherlands, Harderwijk
Posts: 321
StefanScholte is on a distinguished road
Default

No there isn't
Reply With Quote
  #6  
Old 10-23-2009, 03:33 AM
ajay_007 ajay_007 is offline
OBX.1 Kenobi
 
Join Date: Apr 2009
Posts: 26
ajay_007 is on a distinguished road
Default

Can you paste any template of that XML.
Have you provided any thing in your Source transformer?
In that just check blank spaces in Outbound message as well as inbound
Reply With Quote
  #7  
Old 10-29-2009, 01:16 PM
albertosaez albertosaez is offline
 
Join Date: Sep 2006
Location: Valladolid, Spain
Posts: 842
albertosaez is an unknown quantity at this point
Default

This must be an encoding problem. Your strange character seems to be a BOM (Byte Order Mark) of UTF.16 files.

Which is the XML encoding ? MIrth FileRead assume you're reading in the OS default encoding. If it's differnet to the XML file you'll get problems.

You can read the file as bytes and then convert it to a string For example:

var xmlData =''+ Packages.java.lang.String(FileUtil.readBytes('file name'),"UTF-16");
Reply With Quote
Reply

Tags
xml;filereader;error

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation