cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping error:Content is not allowed in prolog.

former_member305454
Participant
0 Kudos

Hi All,

I am trying to read XML through groovy script , while reading XML getting error:

Content is not allowed in prolog.

Any idea how to resolve this error.

Accepted Solutions (0)

Answers (1)

Answers (1)

MortenWittrock
Active Contributor
0 Kudos

Hi Aditya

Check that you don't have e.g. whitespace before the XML prolog (i.e. the <?xml ... ?> bit). Also, there might be an issue with the UTF-8 Byte Order Mark (BOM). You might - for testing purposes - want to place a Content Modifier step immediately before your script step, in order to set an XML body that you know to be correct.

If you are able to show the code and the payload, that would be helpful as well.

Regards,

Morten

former_member305454
Participant

Hi Morten,

Thanks For Reply, Now issue is resolved . Actually I was storing XML in property and that property i was using in Custom Function.

While defining property i didn't gave Data Type, After giving data type in property as java.lang.String it is working.

Regards,

Aditya

habilaltin
Explorer
0 Kudos

Aditya's comment is not appreciated enough! It is actually the solution.

I didn't assigned the data type in the Content Modifier neither. Somehow it worked on the other stream of my multicast, so I didn't even bother to look for it. Interesting enough my message contained an array of digits when I logged the body in groovy script.

javax.script.ScriptException: java.lang.Exception: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 
Content is not allowed in prolog.@ line ... , cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1;