net.fortuna.ical4j.data

## Class HCalendarParser

- java.lang.Object
- - net.fortuna.ical4j.data.HCalendarParser

All Implemented Interfaces:
  CalendarParser

    public class HCalendarParser
    extends Object
    implements CalendarParser

A `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.

### Supported Components

This parser recognizes only "vevent" components.

### Supported Properties

This parser recognizes the following properties:

- "dtstart"
- "dtend"
- "duration"
- "summary"
- "uid"
- "dtstamp"
- "category"
- "location"
- "url"
- "description"
- "last-modified"
- "status"
- "class"
- "attendee"
- "contact"
- "organizer"

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.

#### Date and Date-Time Properties

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.

### Supported Parameters

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 Summary

Constructors
Constructor and Description
`HCalendarParser()`

### Method Summary

Methods
`void` `parse(InputStream in, ContentHandler handler)` Parse the iCalendar data from the specified input stream.
`void` `parse(Reader in, ContentHandler handler)` Parse the iCalendar data from the specified reader.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HCalendarParser

    public HCalendarParser()

### Method Detail

#### parse

    public void parse(InputStream in,
             ContentHandler handler)
               throws IOException,
                      ParserException

Parse the iCalendar data from the specified input stream.

Specified by:
  `parse` in interface `CalendarParser`
Parameters:
  `in` - an input stream from which to read iCalendar data
  `handler` - the content handler to notify during parsing
Throws:
  `IOException` - thrown when unable to read from the specified stream
  `ParserException` - thrown if an error occurs during parsing

#### parse

    public void parse(Reader in,
             ContentHandler handler)
               throws IOException,
                      ParserException

Parse the iCalendar data from the specified reader.

Specified by:
  `parse` in interface `CalendarParser`
Parameters:
  `in` - a reader from which to read iCalendar data
  `handler` - the content handler to notify during parsing
Throws:
  `IOException` - thrown when unable to read from the specified reader
  `ParserException` - thrown if an error occurs during parsing