Question
When processing messages it is possible that you get a parsing error. When looking into your XML file, nothing seems to be wrong.
Caused by: com.altova.SourceInstanceUnavailableException: cannot parse input stream.
at com.altova.xml.XmlTreeOperations.loadDocument(XmlTreeOperations.java:71)
at com.altova.xml.XmlTreeOperations.loadDocument(XmlTreeOperations.java:39)
at com.mapforce.MappingMapToweborder.run(MappingMapToweborder.java:898)
... 81 common frames omitted
Caused by: 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(Unknown Source)
at com.altova.xml.XmlTreeOperations.loadDocument(XmlTreeOperations.java:66)
... 83 common frames omitted
When saving the message in notepad, the message suddenly checks out and there are nor problems...
WHat is going on?
Answer
When you get inexplicable messages like this, your XML file probably has a BOM. A BOM or Byte Order Marker is a special marker added at the very beginning of an Unicode file encoded in UTF-8, UTF-16 or UTF-32.It is used to indicate whether the file uses the big-endian or little-endian byte order. The BOM is mandatory for UTF-16 and UTF-32, but it is optional for UTF-8.
The problem with a BOM is, that it is not visible in an ASCII editor, but you can detect it in a HEX editor.
The byte order mark is likely to be one of these byte sequences:
UTF-8 BOM : ef bb bf
UTF-16BE BOM: fe ff
UTF-16LE BOM: ff fe
UTF-32BE BOM: 00 00 fe ff
UTF-32LE BOM: ff fe 00 00
ConnectPlaza does not like the BOM and you can get rid of it by using the Encoding Converter service, converting the message from, for instance, UTF-8 to UTF-8. This will remove the BOM from the file.
Keep in mind that some applications require a BOM.