on 04-06-2017 11:50 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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;
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.