質問

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