骆驼CSVRecord骆驼Bindy [英] Camel CSVRecord Camel Bindy

查看:143
本文介绍了骆驼CSVRecord骆驼Bindy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有bindy(2.16.0)的骆驼来解析csv文件.该文件包含页眉和页脚.两者都用作描述所有其他记录的通用数据的元数据. (客户定义,因此我无法更改CSV格式)

I'm using camel with bindy (2.16.0) to parse a csv file. The file contains a header and a footer. Both are used as metadata to describe common data for all other records. (Customer defined so I cant change the CSV Format)

我正在使用Bindy为我解析数据.我遇到的问题是,对于CSVRecord,您不能排除页脚.我可以跳过页眉,但是数据解析失败,因为由于数据格式不同,它无法解析页脚.

Im using Bindy to parse the data for me. The issue that I'm having is that for CSVRecord you cannot exclude the footer. I'm able to skip the header but the parsing of the data fails because it cannot parse the footer since the data format is different.

是否可以从CSVRecord绑定中排除最后一行/页脚,或者以其他方式骆驼读取并删除最后一行?

Is there a way to exclude the last line/footer from CSVRecord bindy or maybe have camel read and remove the last line in another way?

推荐答案

目前,bindy不支持此功能.您的案例中的页脚仅是一行吗?还是有任何特殊的前导标记来指示其页脚?

No this is currently not supported in bindy. Is the footer in your case a single line only? Or does it have any special leading marker to indicate its a footer?

我们也许可以改善绑定能力以支持跳过页脚.因此,默认情况下,页脚可能只是最后一行.但是,只是想知道人们是否可以将多行作为页脚?

We could maybe improve bindy to support skipping footer. So maybe a footer by default is just the last line. But just wonder if people may have multiple lines as footer?

您需要先手动删除最后一行,然后再使用bindy对其进行解析.如果文件不大,并且可以将其存储在内存中,则可以使用Camel处理器/bean并从消息正文中删除最后一行.

You would need to manually remove that last line yourself before parsing it with bindy. If the file is not big, and you can have it in memory you can use a Camel processor / bean and remove the last line from the message body.

这篇关于骆驼CSVRecord骆驼Bindy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆