Announcement Announcement Module
Collapse
No announcement yet.
XMLStreamException : Message: Content is not allowed in prolog Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XMLStreamException : Message: Content is not allowed in prolog

    Hi,

    I have a problem when i want to read xml file on UTF8 with StaxEventItemReader on unix environment. This is my log:

    Caused by: org.springframework.dao.DataAccessResourceFailureE xception: Error while reading from event reader; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
    at org.springframework.batch.item.xml.StaxEventItemRe ader.moveCursorToNextFragment(StaxEventItemReader. java:160)
    at org.springframework.batch.item.xml.StaxEventItemRe ader.doRead(StaxEventItemReader.java:218)
    at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.read(AbstractItemCou ntingItemStreamItemReader.java:85)
    at org.springframework.batch.core.step.item.SimpleChu nkProvider.doRead(SimpleChunkProvider.java:90)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProvider.read(FaultTolerantChunkProvider. java:68)
    ... 27 more



    At first time, i thought it's on my xml file.

    Maybe there is a Byte Order Mark at the beginning xml file but not. I used the command line to delete BOM:
    awk '{if(NR==1)sub(/^\xef\xbb\xbf/,"");print}' INFILE > OUTFILE
    and i have the same error.

    Remark:
    On eclipse environment, it's worked.

    I don't have any idea. Can you help me

  • #2
    It sounds like you have some unwanted characters (most probably the BOM) in your xml file. To verify this, I suggest you manually create a simple XML file that resembles your actual input. Then use your reader to read the new XML file.

    Comment

    Working...
    X