3

An RSS 2.0 feed I need to process returns date entries which ROME's DateParser cannot parse, delivering null for all dates. More than that, no suitable SimpleDateFormat pattern exists (which could simply be specified in rome.properties), so the input needs to be pre-processed before it can be parsed. ROME's DateParser already does such things internally, like replacing "UT" in RFC822 date input by "GMT" before feeding it to the Java DateFormat parser. I just need to add a similar modification.

What I'm doing now is to include within my project copies of ROME's RSS20Parser.java and all feed parser classes it extends, as far as necessary to cover all references to ROME's DateParser, and provide my own DateParser class which the feed parser classes then reference instead of the orginal DateParser.

Given ROME's plugin structure, I was hoping to be able to simply plug in my own DateParser, but found no way to do so. Did I miss something? Can I somehow use ROME with my own DateParser, but without having to replicate all the feed parser classes which are expected to use it?

1 Answers1

2

See the manual here To customize date format for the DateParser in ROME, you need to create your custom rome.properties with the proper datetime.extra.masks, e.g:

datetime.extra.masks=EEE, dd MMM yyyy HH:mm:ss z

Put the custom properties file in src/main/resources. All rome.properties files will be aggregated upon loading.

canhnt
  • 181
  • 1
  • 6
  • Beside the question being almost two years old, he mentioned, a SimpleDateFormat pattern does not do the trick. – qqilihq Aug 01 '14 at 14:58
  • This works GREAT. Keep in mind that trailing/leading spaces might effect the results, ie. up to 1.2.0 they will never be hit! Knowing this limitation - it works fine. – LeO May 16 '19 at 08:59