I have irregular (albeit consistent) "csv" files I need to parse. Content looks like this:
Field1: Field1Text
Field2: Field2Text
Field3 (need to ignore)
Field4 (need to ignore)
Field5
Field5Text
// Cars - for example
#,Col1,Col2,Col3,Col4,Col5,Col6
#1,Col1Text,Col2Text,Col3Text,Col4Text,Col5Text,Col6Text
#2,Col1Text,Col2Text,Col3Text,Col4Text,Col5Text,Col6Text
#3,Col1Text,Col2Text,Col3Text,Col4Text,Col5Text,Col6Text
Ideally I would like to use a similar approach as here.
I ultimately want to end up with an object like:
String field1;
String field2;
String field5;
List<Car> cars;
I currently have the following problems:
- After adding some exploratory tests, lines beginning with hash(#) are ignored. I don't want this, is there anyway to escape?
- My intention was to use a BeanListProcessor for the cars section and process the other fields using separate row processors. Then combine the result in the object mentioned above. Am I missing any tricks here?