Вопрос

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