public class HCalendarParser extends java.lang.Object implements CalendarParser
CalendarParser
that parses XHTML documents that include calendar data marked up with the hCalendar
microformat.
The parser treats the entire document as a single "vcalendar" context, ignoring any vcalendar
elements
and adding all components in the document to a single generated calendar.
Since hCalendar does not include product information, the PRODID
property is omitted from the generated
calendar. The hCalendar profile is supposed to define the iCalendar version that it represents, but it does not, so
version 2.0 is assumed.
This parser recognizes only "vevent" components.
This parser recognizes the following properties:
hCalendar allows for some properties to be represented by nested microformat records, including hCard, adr and geo. This parser does not recognize these records. It simply accumulates the text content of any child elements of the property element and uses the resulting string as the property value.
hCalendar date-time values are formatted according to RFC 3339. There is no representation in this specification for time zone ids. All date-times are specified either in UTC or with an offset that can be used to convert the local time into UTC. Neither does hCal provide a reprsentation for floating date-times. Therefore, all date-time values produced by this parser are in UTC.
Some examples in the wild provide date and date-time values in iCalendar format rather than RFC 3339 format. Although not technically legal according to spec, these values are accepted. In this case, floating date-times are produced by the parser.
hCalendar does not define attributes, nested elements or other information elements representing parameter data. Therefore, this parser does not set any property parameters except as implied by property value data (e.g. VALUE=DATE-TIME or VALUE=DATE for date-time properties).
Constructor and Description |
---|
HCalendarParser() |
Modifier and Type | Method and Description |
---|---|
void |
parse(java.io.InputStream in,
ContentHandler handler)
Parse the iCalendar data from the specified input stream.
|
void |
parse(java.io.Reader in,
ContentHandler handler)
Parse the iCalendar data from the specified reader.
|
public void parse(java.io.InputStream in, ContentHandler handler) throws java.io.IOException, ParserException
parse
in interface CalendarParser
in
- an input stream from which to read iCalendar datahandler
- the content handler to notify during parsingjava.io.IOException
- thrown when unable to read from the specified streamParserException
- thrown if an error occurs during parsingpublic void parse(java.io.Reader in, ContentHandler handler) throws java.io.IOException, ParserException
parse
in interface CalendarParser
in
- a reader from which to read iCalendar datahandler
- the content handler to notify during parsingjava.io.IOException
- thrown when unable to read from the specified readerParserException
- thrown if an error occurs during parsing