About
I needed a iCalendar file parser for Javascript in my latest XUL-project. Didn't find any, so I made my own. It is released under the GPL license. Please let me know if you find it useful, or have made some neat mods to it.
Contents
Class: iCalReader() - parser object.
Public methods:
- Array prepareData(String data) : set and prepare iCalendar data to read. Throws exception if invalid data.
- void parse() : parse the data.
- void sort() : sort events in the calendar object.
- vCalendar getCalendar() : get the calendar object.
Class: vCalendar() - calendar object.
Public methods:
- Array getEvents() : get a array of the calendar events.
- Int getNrOfEvents() : get the number of events.
- Array getPropertyNames() : get an array of the calendar's property names.
- PropertyMap getProperties() : get the property map object for the calendar.
- 0bject getProperty(String key) : get a property value by name.
Throws exception if property is not found (invalidPropertyException).
- vEvent getEventAtIndex(int index) : get an event object at given position in calendar.
Class: vEvent() - event object.
Public methods:
- Date getStartDate() : get the starting date for the event.
- Date getEndDate() : get the ending date for the event.
- String getTimezone() : get the timezone accociated with the event.
- PropertyMap getRuleProperties() : get a map of rules for the event.
- Array getPropertyNames() : get an array of available property names.
- Object getProperty(String key) : get an event property by name.
Throws exception if property is not found (invalidPropertyException).
- String getHtmlValue(String key) : get an string property in HTML format (\n become br). Throws exception if property is not found (invalidPropertyException).
Class: PropertyMap() - property hashmap object for vCal and vEvent.
Public methods:
- Object getProperty(String) : get property value of property with key.
- void toString() : print an overview of the map's properties and values.
- boolean containsValue(Object value) : check if the property map contains a given value.
- boolean containsKey(String key) : check if the property map contains a given property name.
- int size() : the length of the property map.
Published 2007-08-13, 14:07.