I've an xml file (not conform) with no cariage return, it is strutured like this :

<?xml version="1.0" encoding="utf-8"?><DOC><AAAA>valueA</AAAA><BBBB>valueB</BBBB><CCCC>valueC</CCCC></DOC><?xml version="1.0" encoding="utf-8"?><DOC><AAAA>valueA</AAAA><BBBB>valueB</BBBB><CCCC>valueC</CCCC></DOC><?xml version="1.0" encoding="utf-8"?><DOC><AAAA>valueA</AAAA><BBBB>valueB</BBBB><CCCC>valueC</CCCC></DOC><?xml version="1.0" encoding="utf-8"?><DOC><AAAA>valueA</AAAA><BBBB>valueB</BBBB><CCCC>valueC</CCCC></DOC><?xml version="1.0" encoding="utf-8"?><DOC><AAAA>valueA</AAAA><BBBB>valueB</BBBB><CCCC>valueC</CCCC></DOC>

How can I read it with SpringBatch, is there another way to do this, without write a tasklet to insert cariage return or write a custom FlatFileItemReader ?

Thx

有帮助吗?

解决方案

The SimpleBinaryBufferedReaderFactory class do the job :

A BufferedReaderFactory useful for reading simple binary (or text) files with no line endings, such as those produced by mainframe copy books. The reader splits a stream up across fixed line endings (rather than the usual convention based on plain text). The line endings are discarded, just as with the default plain text implementation.

You only need to set the LineEnding property =)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top