I'm looking for a Java API to convert ICS (aka iCal) attachments to nicely formatted HTML or plaintext for display purposes. Ideally, it would be able to handle:
I'm looking at iCal4j, which has a nice DOM parser, but no way to serialize to anything but iCal.
Sorry mate, if you Googled around and found nothing, then its a sure set of unique requirements you got there, time to innovate.
Take what you have, think up some ideas, and try them out, comes with the job!
I didn't find a better alternative to ical4j. I used it fairly successfully. Unfortunately, as you point out, all it does is to bind to XML, with no other way to output it to something else. You could walk the DOM after creation and output the relevant text - although this seems a bit strange since all you want is text/html, I had the same issue and just ended up parsing out the XML.
The iCal4j API is a bit strange and you might want to relax the parsing and enable outlook/notes compatibility to help you along the way. You could write your own Parser and that implements net.fortuna.ical4j.data.CalendarParser
and pull out the necessary information into plain text that way. I think the default net.fortuna.ical4j.data.CalendarParserImpl
is about 500 lines of code, you could alternatively hack that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With