It has been a while since I have been able to write some Java code outside the context of Android. So I decided to take my C# NewsFeedParser (https://github.com/RabidDog/C--News-Feed-Parser) and port it to Java just as an exercise. While I have just finished the RSS content parser I have also picked up a few issues with the C# version so will be cleaning that up soon.
Most of the concepts where the same but I must admit, I missed the internal key word available in C#
. I still have to do a few tests to verify that I haven’t accidentally exposed anything in the library.
The one thing that was a bit upsetting is Java’s handling of date strings. The parsing of date strings requires a format to be stipulated if you are using the framework parsing mechanism. Examples can be found at http://techtracer.com/2007/03/28/convert-date-to-string-and-string-to-date-in-java/ and http://javatechniques.com/blog/dateformat-and-simpledateformat-examples/ and many other places on how to parse a date using a format. While this works when you have control of the format, it can be quiet tricky when you don’t have control over the format.
A bit more searching led me to http://stackoverflow.com/questions/3389348/parse-any-date-in-java and then a little piece of gold. http://darthanthony.wordpress.com/2009/05/29/java-date-parsing-with-an-unknown-format/ pointed to a project called the POJava Project. The article also pointed out that there is a handy DateTime object that has the capacity to parse dates from most strings.
Usage is something like
import org.pojava.datetime.DateTime;
//rest of the class definition
Date date = DateTime.parse(myDateString).toDate();
So now you can parse many strings into date objects. Big thanks to the guys over at the POJava project. You can find them at http://www.pojava.org/.
Time to go clean up the C# project 
86e187fe-49ad-4e79-ab5e-660813ee1662|0|.0