icalendar.parser.xcal.component module#
A parser for components.
- class icalendar.parser.xcal.component.XCalComponentsParser(element, component_factory, types_factory)[source]#
Bases:
XCalParserA parser of an iCalendar stream or IC:components which contain component elements that yields
Components.- Parameters:
component_factory (
ComponentFactory) – The component factory to use.element (
Element|ElementAdapter) – The element to parse.types_factory (
TypesFactory) – The types factory to use.
Examples
elementcan be an iCalendar stream that contains one or more IC:vcalendar components.<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"> <vcalendar> ... </vcalendar> </icalendar>
Components can contain other components inside the IC:components XML element. The parameter
elementcan be such an IC:components XML element.<components> <vevent> ... </vevent> </components>
- parse_component()[source]#
Convert one child into a
Component.- Return type:
- Returns:
The parsed component.
- Raises:
XCalParsingError – If there is an error in the child.
InvalidParserState – If all components have been parsed or a property value type didn't parse anything.
Example
The XML below shows the structure of one component element element that gets parsed by this method.
vcalendaris the name of the component element. The XML below shows the structure of one component element that gets parsed by this method.vcalendaris the name of the component element. Each component element can contain an IC:properties and an IC:components element with more components.<vcalendar> <properties> ... </properties> <components> <vevent> ... </vevent> </components> </vcalendar>
- parse_component_from_child()[source]#
Parse a component from a child element.
- Return type:
- Returns:
The parsed component.
- Raises:
XCalParsingError – If there is an error in the child.
InvalidParserState – If all components have been parsed or a property value type didn't parse anything.